2 * \brief Macros for compiler optimisation.
8 #if ((defined __GNUC__) || (defined __clang__)) && !(defined QPMS_NO_BUILTIN_EXPECT)
9 /// Wrapper over gcc's and clang's __builtin_expect.
10 /** If expands to __builtin_expect if gcc or clang are used,
11 * else expands only to the first argument.
13 #define QPMS_EXPECT(exp, c) __builtin_expect(exp, c)
14 #define QPMS_LIKELY(x) __builtin_expect(!!(x), 1)
15 #define QPMS_UNLIKELY(x) __builtin_expect(!!(x), 0)
17 #define QPMS_LIKELY(x) (x)
18 #define QPMS_UNLIKELY(x)
19 #define QPMS_EXPECT(exp,c) (exp)
22 #if (defined(__GNUC__) && __GNUC__ >= 3) || \
23 (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 8)
25 #define QPMS_NORETURN __attribute__((noreturn))