Commit 903990db authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

tweak FOLLY_LIKELY to accept complex expressions

Summary: Complex expressions involving certain tokens parse at preprocessor time as multiple preprocessor arguments. Quite awkward. The trick is to change the preprocessor macro to deal in variadic arguments.

Reviewed By: ot, Orvid, luciang

Differential Revision: D27986071

fbshipit-source-id: a126fca260396418b14b7367e3e41ddeea78b7af
parent cdf0badc
......@@ -38,8 +38,8 @@
// blocks which unconditionally call [[noreturn]]-annotated functions. Such
// cases do not require likeliness annotations.
#define FOLLY_LIKELY(x) FOLLY_DETAIL_BUILTIN_EXPECT((x), 1)
#define FOLLY_UNLIKELY(x) FOLLY_DETAIL_BUILTIN_EXPECT((x), 0)
#define FOLLY_LIKELY(...) FOLLY_DETAIL_BUILTIN_EXPECT((__VA_ARGS__), 1)
#define FOLLY_UNLIKELY(...) FOLLY_DETAIL_BUILTIN_EXPECT((__VA_ARGS__), 0)
// Un-namespaced annotations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment