blob: b501cb7a6e59197a0da4def91598058231af40df [file] [log] [blame]
Richard Smithdac3ea42019-08-14 02:30:11 +00001// RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -verify -DVERIFY
2// expected-no-diagnostics
3
4#ifndef __has_feature
5#error Should have __has_feature
6#endif
7
8#if __has_feature(something_we_dont_have)
9#error Bad
10#endif
11
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
21#endif
22
23// These are technically implemented as keywords, but __has_builtin should
24// still return true.
25#if !__has_builtin(__builtin_LINE) || \
26 !__has_builtin(__builtin_FILE) || \
27 !__has_builtin(__builtin_FUNCTION) || \
28 !__has_builtin(__builtin_COLUMN) || \
29 !__has_builtin(__array_rank) || \
30 !__has_builtin(__underlying_type) || \
31 !__has_builtin(__is_trivial) || \
Richard Smitheb535d22019-10-29 14:44:38 -070032 !__has_builtin(__is_same_as) || \
Richard Smithdac3ea42019-08-14 02:30:11 +000033 !__has_builtin(__has_unique_object_representations)
34#error Clang should have these
35#endif
36
37// This is a C-only builtin.
38#if __has_builtin(__builtin_types_compatible_p)
39#error Clang should not have this in C++ mode
40#endif
41
42#if __has_builtin(__builtin_insanity)
43#error Clang should not have this
44#endif