21 #ifndef COMPILER_HINTS_H
22 #define COMPILER_HINTS_H
38 #define NORETURN __attribute__((noreturn))
53 #define PURE __attribute__((pure))
66 #define MAYBE_UNUSED __attribute__((unused))
80 #if defined(__llvm__) || defined(__clang__)
81 #define NO_SANITIZE_ARRAY __attribute__((no_sanitize("address")))
83 #define NO_SANITIZE_ARRAY
93 #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5) || defined(__clang__)
94 #define UNREACHABLE() __builtin_unreachable()
96 #define UNREACHABLE() do { } while (1)
110 #define WITHOUT_PEDANTIC(...) \
111 _Pragma("GCC diagnostic push") \
112 _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
114 _Pragma("GCC diagnostic pop")
126 #define DECLARE_CONSTANT(identifier, const_expr) \
127 WITHOUT_PEDANTIC(enum { identifier = const_expr };)
142 #define IS_CT_CONSTANT(expr) <IMPLEMENTATION>
143 #elif defined(__GNUC__)
145 #define IS_CT_CONSTANT(expr) __builtin_constant_p(expr)
147 #define IS_CT_CONSTANT(expr) 0
157 #define likely(x) __builtin_expect((uintptr_t)(x), 1)
166 #define unlikely(x) __builtin_expect((uintptr_t)(x), 0)
179 #define assume(cond) ((cond) ? (void)0 : UNREACHABLE())
181 #define assume(cond) assert(cond)
POSIX.1-2008 compliant version of the assert macro.
static unsigned may_be_zero(unsigned n)
Wrapper function to silence "comparison is always false due to limited range of data type" t...