00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LLVM_SUPPORT_COMPILER_H
00016 #define LLVM_SUPPORT_COMPILER_H
00017
00018 #ifndef __has_feature
00019 # define __has_feature(x) 0
00020 #endif
00021
00026 #if (__GNUC__ >= 4) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00027 #define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
00028 #else
00029 #define LLVM_LIBRARY_VISIBILITY
00030 #endif
00031
00032 #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00033 #define LLVM_ATTRIBUTE_USED __attribute__((__used__))
00034 #else
00035 #define LLVM_ATTRIBUTE_USED
00036 #endif
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00047 #define LLVM_ATTRIBUTE_UNUSED __attribute__((__unused__))
00048 #else
00049 #define LLVM_ATTRIBUTE_UNUSED
00050 #endif
00051
00052 #ifdef __GNUC__ // aka 'ATTRIBUTE_CONST' but following LLVM Conventions.
00053 #define LLVM_ATTRIBUTE_READNONE __attribute__((__const__))
00054 #else
00055 #define LLVM_ATTRIBUTE_READNONE
00056 #endif
00057
00058 #ifdef __GNUC__ // aka 'ATTRIBUTE_PURE' but following LLVM Conventions.
00059 #define LLVM_ATTRIBUTE_READONLY __attribute__((__pure__))
00060 #else
00061 #define LLVM_ATTRIBUTE_READONLY
00062 #endif
00063
00064 #if (__GNUC__ >= 4)
00065 #define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
00066 #else
00067 #define BUILTIN_EXPECT(EXPR, VALUE) (EXPR)
00068 #endif
00069
00070
00071
00072
00073
00074
00075 #ifdef __GNUC__
00076 #define EXTERN_TEMPLATE_INSTANTIATION(X) __extension__ extern template X
00077 #define TEMPLATE_INSTANTIATION(X) template X
00078 #else
00079 #define EXTERN_TEMPLATE_INSTANTIATION(X)
00080 #define TEMPLATE_INSTANTIATION(X)
00081 #endif
00082
00083
00084
00085 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
00086 #define LLVM_ATTRIBUTE_NOINLINE __attribute__((noinline))
00087 #elif defined(_MSC_VER)
00088 #define LLVM_ATTRIBUTE_NOINLINE __declspec(noinline)
00089 #else
00090 #define LLVM_ATTRIBUTE_NOINLINE
00091 #endif
00092
00093
00094
00095
00096
00097 #if __GNUC__ > 3
00098 #define LLVM_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
00099 #elif defined(_MSC_VER)
00100 #define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline
00101 #else
00102 #define LLVM_ATTRIBUTE_ALWAYS_INLINE
00103 #endif
00104
00105
00106 #ifdef __GNUC__
00107 #define LLVM_ATTRIBUTE_NORETURN __attribute__((noreturn))
00108 #elif defined(_MSC_VER)
00109 #define LLVM_ATTRIBUTE_NORETURN __declspec(noreturn)
00110 #else
00111 #define LLVM_ATTRIBUTE_NORETURN
00112 #endif
00113
00114
00115 #if __has_feature(attribute_deprecated_with_message)
00116 # define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
00117 decl __attribute__((deprecated(message)))
00118 #elif defined(__GNUC__)
00119 # define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
00120 decl __attribute__((deprecated))
00121 #elif defined(_MSC_VER)
00122 # define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
00123 __declspec(deprecated(message)) decl
00124 #else
00125 # define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
00126 decl
00127 #endif
00128
00129
00130
00131
00132 #if defined(__clang__) || (__GNUC__ > 4) \
00133 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
00134 # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
00135 #endif
00136
00137 #endif