From c9b41e27ab6d2fdc6f7027c179d578684ad1c623 Mon Sep 17 00:00:00 2001 From: Elizabeth Smith Date: Thu, 17 Apr 2014 13:36:10 -0700 Subject: [PATCH] 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 --- folly/FBString.h | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.34.1