15 #ifndef LLVM_SUPPORT_COMPILER_H
16 #define LLVM_SUPPORT_COMPILER_H
19 # define __has_feature(x) 0
22 #ifndef __has_extension
23 # define __has_extension(x) 0
26 #ifndef __has_attribute
27 # define __has_attribute(x) 0
31 # define __has_builtin(x) 0
37 #ifndef LLVM_GNUC_PREREQ
38 # if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
39 # define LLVM_GNUC_PREREQ(maj, min, patch) \
40 ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
41 ((maj) << 20) + ((min) << 10) + (patch))
42 # elif defined(__GNUC__) && defined(__GNUC_MINOR__)
43 # define LLVM_GNUC_PREREQ(maj, min, patch) \
44 ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
46 # define LLVM_GNUC_PREREQ(maj, min, patch) 0
50 #ifndef LLVM_ATTRIBUTE_UNUSED_RESULT
51 #if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0)
52 #define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__))
54 #define LLVM_ATTRIBUTE_UNUSED_RESULT
59 #if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0)
60 #define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
61 #define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
63 #define LLVM_LIKELY(EXPR) (EXPR)
64 #define LLVM_UNLIKELY(EXPR) (EXPR)