1 // RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -verify -DVERIFY
2 // RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -fms-extensions -DMS -verify -DVERIFY
5 #error Should have __has_feature
8 #if __has_feature(something_we_dont_have)
12 #if !__has_builtin(__builtin_huge_val) || \
13 !__has_builtin(__builtin_shufflevector) || \
14 !__has_builtin(__builtin_convertvector) || \
15 !__has_builtin(__builtin_trap) || \
16 !__has_builtin(__c11_atomic_init) || \
17 !__has_builtin(__builtin_launder) || \
18 !__has_feature(attribute_analyzer_noreturn) || \
19 !__has_feature(attribute_overloadable)
20 #error Clang should have these
23 // These are technically implemented as keywords, but __has_builtin should
25 #if !__has_builtin(__builtin_LINE) || \
26 !__has_builtin(__builtin_FILE) || \
27 !__has_builtin(__builtin_FILE_NAME) || \
28 !__has_builtin(__builtin_FUNCTION) || \
29 !__has_builtin(__builtin_COLUMN) || \
30 !__has_builtin(__array_rank) || \
31 !__has_builtin(__underlying_type) || \
32 !__has_builtin(__is_trivial) || \
33 !__has_builtin(__is_same_as) || \
34 !__has_builtin(__has_unique_object_representations)
35 #error Clang should have these
39 #if !__has_builtin(__builtin_FUNCSIG)
40 #error Clang should have this
42 #elif __has_builtin(__builtin_FUNCSIG)
43 #error Clang should not have this without '-fms-extensions'
46 // This is a C-only builtin.
47 #if __has_builtin(__builtin_types_compatible_p)
48 #error Clang should not have this in C++ mode
51 #if __has_builtin(__builtin_insanity)
52 #error Clang should not have this
55 // Check __has_constexpr_builtin
56 #if !__has_constexpr_builtin(__builtin_fmax) || \
57 !__has_constexpr_builtin(__builtin_fmin)
58 #error Clang should have these constexpr builtins
61 #if __has_constexpr_builtin(__builtin_cbrt)
62 #error This builtin should not be constexpr in Clang
65 #if __has_constexpr_builtin(__builtin_insanity)
66 #error This is not a builtin in Clang
69 // expected-error@+1 {{missing '(' after '__has_constexpr_builtin'}} expected-error@+1 {{expected value}}
70 #if __has_constexpr_builtin
73 // expected-error@+1 {{builtin feature check macro requires a parenthesized identifier}}
74 #if __has_constexpr_builtin("__builtin_fmax")
77 // expected-error@+1 {{too many arguments}}
78 #if __has_constexpr_builtin(__builtin_fmax, __builtin_fmin)