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_CONSTEXPR 53 # define LLVM_CONSTEXPR constexpr 55 # define LLVM_CONSTEXPR 57 # elif defined(__has_feature) 58 # if __has_feature(cxx_constexpr) 59 # define LLVM_CONSTEXPR constexpr 61 # define LLVM_CONSTEXPR 63 # elif defined(__GXX_EXPERIMENTAL_CXX0X__) 64 # define LLVM_CONSTEXPR constexpr 65 # elif defined(__has_constexpr) 66 # define LLVM_CONSTEXPR constexpr 68 # define LLVM_CONSTEXPR 72 #ifndef LLVM_ATTRIBUTE_UNUSED_RESULT 73 #if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0) 74 #define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__)) 75 #elif defined(_MSC_VER) 76 #define LLVM_ATTRIBUTE_UNUSED_RESULT _Check_return_ 78 #define LLVM_ATTRIBUTE_UNUSED_RESULT 83 #if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0) 84 #define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true) 85 #define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) 87 #define LLVM_LIKELY(EXPR) (EXPR) 88 #define LLVM_UNLIKELY(EXPR) (EXPR)