Check whether gcc version supports __builtin_unreachable().
This commit is contained in:
parent
56af64dc19
commit
7928f62273
@ -57,10 +57,21 @@
|
|||||||
# define JEMALLOC_CC_SILENCE_INIT(v)
|
# define JEMALLOC_CC_SILENCE_INIT(v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define JEMALLOC_GNUC_PREREQ(major, minor) \
|
||||||
|
(!defined(__clang__) && \
|
||||||
|
(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
|
||||||
|
#define JEMALLOC_CLANG_HAS_BUILTIN(builtin) \
|
||||||
|
(defined(__clang__) && __has_builtin(builtin))
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# define likely(x) __builtin_expect(!!(x), 1)
|
# define likely(x) __builtin_expect(!!(x), 1)
|
||||||
# define unlikely(x) __builtin_expect(!!(x), 0)
|
# define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
# if JEMALLOC_GNUC_PREREQ(4, 6) || \
|
||||||
|
JEMALLOC_CLANG_HAS_BUILTIN(__builtin_unreachable)
|
||||||
# define unreachable() __builtin_unreachable()
|
# define unreachable() __builtin_unreachable()
|
||||||
|
# else
|
||||||
|
# define unreachable()
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# define likely(x) !!(x)
|
# define likely(x) !!(x)
|
||||||
# define unlikely(x) !!(x)
|
# define unlikely(x) !!(x)
|
||||||
|
Loading…
Reference in New Issue
Block a user