fbstring likely/unlikley ifdef for stuff that doesn't support it
authorElizabeth Smith <elizabeths@fb.com>
Thu, 17 Apr 2014 20:36:10 +0000 (13:36 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 18 Apr 2014 19:10:23 +0000 (12:10 -0700)
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

folly/FBString.h

index ea0df00cca32a5b9c3e87218d1a053592d4401b1..40e19b53430075f1f05867547d2084adaf4f9381 100644 (file)
 
 // 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