From: Elizabeth Smith Date: Thu, 17 Apr 2014 20:36:10 +0000 (-0700) Subject: fbstring likely/unlikley ifdef for stuff that doesn't support it X-Git-Tag: v0.22.0~593 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c9b41e27ab6d2fdc6f7027c179d578684ad1c623;p=folly.git fbstring likely/unlikley ifdef for stuff that doesn't support it Summary: the fbstring specific unlikely/likely defs were missing the ifdef blocks to avoid breaking things without builtin_expect Test Plan: fbmake runtests Reviewed By: njormrod@fb.com FB internal diff: D1282166 --- diff --git a/folly/FBString.h b/folly/FBString.h index ea0df00c..40e19b53 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -107,8 +107,13 @@ // We defined these here rather than including Likely.h to avoid // redefinition errors when fbstring is imported into libstdc++. +#if defined(__GNUC__) && __GNUC__ >= 4 #define FBSTRING_LIKELY(x) (__builtin_expect((x), 1)) #define FBSTRING_UNLIKELY(x) (__builtin_expect((x), 0)) +#else +#define FBSTRING_LIKELY(x) (x) +#define FBSTRING_UNLIKELY(x) (x) +#endif // Ignore shadowing warnings within this file, so includers can use -Wshadow. #pragma GCC diagnostic push