|
97 | 97 | /// Sadly, this is separate from just rvalue reference support because GCC
|
98 | 98 | /// and MSVC implemented this later than everything else. This appears to be
|
99 | 99 | /// corrected in MSVC 2019 but not MSVC 2017.
|
100 |
| -#if __has_feature(cxx_rvalue_references) || LLVM_GNUC_PREREQ(4, 8, 1) || \ |
101 |
| - LLVM_MSC_PREREQ(1920) |
| 100 | +#if __has_feature(cxx_rvalue_references) || LLVM_MSC_PREREQ(1920) |
102 | 101 | #define LLVM_HAS_RVALUE_REFERENCE_THIS 1
|
103 | 102 | #else
|
104 | 103 | #define LLVM_HAS_RVALUE_REFERENCE_THIS 0
|
|
123 | 122 | /// LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with
|
124 | 123 | /// this attribute will be made public and visible outside of any shared library
|
125 | 124 | /// they are linked in to.
|
126 |
| -#if (__has_attribute(visibility) || LLVM_GNUC_PREREQ(4, 0, 0)) && \ |
127 |
| - !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32) |
| 125 | +#if __has_attribute(visibility) && !defined(__MINGW32__) && \ |
| 126 | + !defined(__CYGWIN__) && !defined(_WIN32) |
128 | 127 | #define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
|
129 | 128 | #define LLVM_EXTERNAL_VISIBILITY __attribute__ ((visibility("default")))
|
130 | 129 | #else
|
|
138 | 137 | #define LLVM_PREFETCH(addr, rw, locality)
|
139 | 138 | #endif
|
140 | 139 |
|
141 |
| -#if __has_attribute(used) || LLVM_GNUC_PREREQ(3, 1, 0) |
| 140 | +#if __has_attribute(used) |
142 | 141 | #define LLVM_ATTRIBUTE_USED __attribute__((__used__))
|
143 | 142 | #else
|
144 | 143 | #define LLVM_ATTRIBUTE_USED
|
|
182 | 181 | // more portable solution:
|
183 | 182 | // (void)unused_var_name;
|
184 | 183 | // Prefer cast-to-void wherever it is sufficient.
|
185 |
| -#if __has_attribute(unused) || LLVM_GNUC_PREREQ(3, 1, 0) |
| 184 | +#if __has_attribute(unused) |
186 | 185 | #define LLVM_ATTRIBUTE_UNUSED __attribute__((__unused__))
|
187 | 186 | #else
|
188 | 187 | #define LLVM_ATTRIBUTE_UNUSED
|
189 | 188 | #endif
|
190 | 189 |
|
191 | 190 | // FIXME: Provide this for PE/COFF targets.
|
192 |
| -#if (__has_attribute(weak) || LLVM_GNUC_PREREQ(4, 0, 0)) && \ |
193 |
| - (!defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)) |
| 191 | +#if __has_attribute(weak) && !defined(__MINGW32__) && !defined(__CYGWIN__) && \ |
| 192 | + !defined(_WIN32) |
194 | 193 | #define LLVM_ATTRIBUTE_WEAK __attribute__((__weak__))
|
195 | 194 | #else
|
196 | 195 | #define LLVM_ATTRIBUTE_WEAK
|
|
218 | 217 | #define LLVM_ATTRIBUTE_MINSIZE
|
219 | 218 | #endif
|
220 | 219 |
|
221 |
| -#if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0) |
| 220 | +#if __has_builtin(__builtin_expect) || defined(__GNUC__) |
222 | 221 | #define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
|
223 | 222 | #define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
|
224 | 223 | #else
|
|
228 | 227 |
|
229 | 228 | /// LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so,
|
230 | 229 | /// mark a method "not for inlining".
|
231 |
| -#if __has_attribute(noinline) || LLVM_GNUC_PREREQ(3, 4, 0) |
| 230 | +#if __has_attribute(noinline) |
232 | 231 | #define LLVM_ATTRIBUTE_NOINLINE __attribute__((noinline))
|
233 | 232 | #elif defined(_MSC_VER)
|
234 | 233 | #define LLVM_ATTRIBUTE_NOINLINE __declspec(noinline)
|
|
237 | 236 | #endif
|
238 | 237 |
|
239 | 238 | /// LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do
|
240 |
| -/// so, mark a method "always inline" because it is performance sensitive. GCC |
241 |
| -/// 3.4 supported this but is buggy in various cases and produces unimplemented |
242 |
| -/// errors, just use it in GCC 4.0 and later. |
243 |
| -#if __has_attribute(always_inline) || LLVM_GNUC_PREREQ(4, 0, 0) |
| 239 | +/// so, mark a method "always inline" because it is performance sensitive. |
| 240 | +#if __has_attribute(always_inline) |
244 | 241 | #define LLVM_ATTRIBUTE_ALWAYS_INLINE inline __attribute__((always_inline))
|
245 | 242 | #elif defined(_MSC_VER)
|
246 | 243 | #define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline
|
|
257 | 254 | #define LLVM_ATTRIBUTE_NODEBUG
|
258 | 255 | #endif
|
259 | 256 |
|
260 |
| -#if __has_attribute(returns_nonnull) || LLVM_GNUC_PREREQ(4, 9, 0) |
| 257 | +#if __has_attribute(returns_nonnull) |
261 | 258 | #define LLVM_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
|
262 | 259 | #elif defined(_MSC_VER)
|
263 | 260 | #define LLVM_ATTRIBUTE_RETURNS_NONNULL _Ret_notnull_
|
|
329 | 326 | /// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
|
330 | 327 | /// to an expression which states that it is undefined behavior for the
|
331 | 328 | /// compiler to reach this point. Otherwise is not defined.
|
332 |
| -#if __has_builtin(__builtin_unreachable) || LLVM_GNUC_PREREQ(4, 5, 0) |
| 329 | +#if __has_builtin(__builtin_unreachable) || defined(__GNUC__) |
333 | 330 | # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
|
334 | 331 | #elif defined(_MSC_VER)
|
335 | 332 | # define LLVM_BUILTIN_UNREACHABLE __assume(false)
|
| 333 | +#else |
| 334 | +# define LLVM_BUILTIN_UNREACHABLE |
336 | 335 | #endif
|
337 | 336 |
|
338 | 337 | /// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression
|
339 | 338 | /// which causes the program to exit abnormally.
|
340 |
| -#if __has_builtin(__builtin_trap) || LLVM_GNUC_PREREQ(4, 3, 0) |
| 339 | +#if __has_builtin(__builtin_trap) || defined(__GNUC__) |
341 | 340 | # define LLVM_BUILTIN_TRAP __builtin_trap()
|
342 | 341 | #elif defined(_MSC_VER)
|
343 | 342 | // The __debugbreak intrinsic is supported by MSVC, does not require forward
|
|
368 | 367 |
|
369 | 368 | /// \macro LLVM_ASSUME_ALIGNED
|
370 | 369 | /// Returns a pointer with an assumed alignment.
|
371 |
| -#if __has_builtin(__builtin_assume_aligned) || LLVM_GNUC_PREREQ(4, 7, 0) |
| 370 | +#if __has_builtin(__builtin_assume_aligned) || defined(__GNUC__) |
372 | 371 | # define LLVM_ASSUME_ALIGNED(p, a) __builtin_assume_aligned(p, a)
|
373 | 372 | #elif defined(LLVM_BUILTIN_UNREACHABLE)
|
374 | 373 | # define LLVM_ASSUME_ALIGNED(p, a) \
|
|
0 commit comments