1 // RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -verify -DVERIFY
4 #error Should have __has_feature
7 #if __has_feature(something_we_dont_have)
11 #if !__has_builtin(__builtin_huge_val) || \
12 !__has_builtin(__builtin_shufflevector) || \
13 !__has_builtin(__builtin_convertvector) || \
14 !__has_builtin(__builtin_trap) || \
15 !__has_builtin(__c11_atomic_init) || \
16 !__has_builtin(__builtin_launder) || \
17 !__has_feature(attribute_analyzer_noreturn) || \
18 !__has_feature(attribute_overloadable)
19 #error Clang should have these
22 // These are technically implemented as keywords, but __has_builtin should
24 #if !__has_builtin(__builtin_LINE) || \
25 !__has_builtin(__builtin_FILE) || \
26 !__has_builtin(__builtin_FUNCTION) || \
27 !__has_builtin(__builtin_COLUMN) || \
28 !__has_builtin(__array_rank) || \
29 !__has_builtin(__underlying_type) || \
30 !__has_builtin(__is_trivial) || \
31 !__has_builtin(__is_same_as) || \
32 !__has_builtin(__has_unique_object_representations)
33 #error Clang should have these
36 // This is a C-only builtin.
37 #if __has_builtin(__builtin_types_compatible_p)
38 #error Clang should not have this in C++ mode
41 #if __has_builtin(__builtin_insanity)
42 #error Clang should not have this
45 // Check __has_constexpr_builtin
46 #if !__has_constexpr_builtin(__builtin_fmax) || \
47 !__has_constexpr_builtin(__builtin_fmin)
48 #error Clang should have these constexpr builtins
51 #if __has_constexpr_builtin(__builtin_cbrt)
52 #error This builtin should not be constexpr in Clang
55 #if __has_constexpr_builtin(__builtin_insanity)
56 #error This is not a builtin in Clang
59 // expected-error@+1 {{missing '(' after '__has_constexpr_builtin'}} expected-error@+1 {{expected value}}
60 #if __has_constexpr_builtin
63 // expected-error@+1 {{builtin feature check macro requires a parenthesized identifier}}
64 #if __has_constexpr_builtin("__builtin_fmax")
67 // expected-error@+1 {{too many arguments}}
68 #if __has_constexpr_builtin(__builtin_fmax, __builtin_fmin)