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 !__has_builtin(__is_trivially_equality_comparable) || \
36 !__has_builtin(__reference_constructs_from_temporary) || \
37 !__has_builtin(__reference_binds_to_temporary) || \
38 !__has_builtin(__reference_converts_from_temporary)
39 #error Clang should have these
43 #if !__has_builtin(__builtin_FUNCSIG)
44 #error Clang should have this
46 #elif __has_builtin(__builtin_FUNCSIG)
47 #error Clang should not have this without '-fms-extensions'
50 // This is a C-only builtin.
51 #if __has_builtin(__builtin_types_compatible_p)
52 #error Clang should not have this in C++ mode
55 #if __has_builtin(__builtin_insanity)
56 #error Clang should not have this
59 // Check __has_constexpr_builtin
60 #if !__has_constexpr_builtin(__builtin_fmax) || \
61 !__has_constexpr_builtin(__builtin_fmin) || \
62 !__has_constexpr_builtin(__builtin_fmaximum_num) || \
63 !__has_constexpr_builtin(__builtin_fminimum_num)
64 #error Clang should have these constexpr builtins
67 #if !__has_constexpr_builtin(__builtin_convertvector)
68 #error Clang should have these constexpr builtins
71 #if !__has_constexpr_builtin(__builtin_shufflevector)
72 #error Clang should have these constexpr builtins
75 #if __has_constexpr_builtin(__builtin_cbrt)
76 #error This builtin should not be constexpr in Clang
79 #if __has_constexpr_builtin(__builtin_insanity)
80 #error This is not a builtin in Clang
83 // expected-error@+1 {{missing '(' after '__has_constexpr_builtin'}} expected-error@+1 {{expected value}}
84 #if __has_constexpr_builtin
87 // expected-error@+1 {{builtin feature check macro requires a parenthesized identifier}}
88 #if __has_constexpr_builtin("__builtin_fmax")
91 // expected-error@+1 {{too many arguments}}
92 #if __has_constexpr_builtin(__builtin_fmax, __builtin_fmin)