[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Preprocessor / is_target.c
blob44bdb11c35af34bd000ce4045b2513668b8ec5dc
1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin-simulator -verify %s
3 #if !__is_target_arch(x86_64) || !__is_target_arch(X86_64)
4 #error "mismatching arch"
5 #endif
7 #if __is_target_arch(arm64)
8 #error "mismatching arch"
9 #endif
11 // Silently ignore invalid archs. This will ensure that older compilers will
12 // accept headers that support new arches/vendors/os variants.
13 #if __is_target_arch(foo)
14 #error "invalid arch"
15 #endif
17 #if !__is_target_vendor(apple) || !__is_target_vendor(APPLE)
18 #error "mismatching vendor"
19 #endif
21 #if __is_target_vendor(unknown)
22 #error "mismatching vendor"
23 #endif
25 #if __is_target_vendor(foo)
26 #error "invalid vendor"
27 #endif
29 #if !__is_target_os(darwin) || !__is_target_os(DARWIN)
30 #error "mismatching os"
31 #endif
33 #if __is_target_os(ios)
34 #error "mismatching os"
35 #endif
37 #if __is_target_os(foo)
38 #error "invalid os"
39 #endif
41 #if !__is_target_environment(simulator) || !__is_target_environment(SIMULATOR)
42 #error "mismatching environment"
43 #endif
45 #if __is_target_environment(unknown)
46 #error "mismatching environment"
47 #endif
49 #if __is_target_environment(foo)
50 #error "invalid environment"
51 #endif
53 #if !__has_builtin(__is_target_arch) || !__has_builtin(__is_target_os) || !__has_builtin(__is_target_vendor) || !__has_builtin(__is_target_environment)
54 #error "has builtin doesn't work"
55 #endif
57 #if __is_target_arch(11) // expected-error {{builtin feature check macro requires a parenthesized identifier}}
58 #error "invalid arch"
59 #endif
61 #if __is_target_arch x86 // expected-error{{missing '(' after '__is_target_arch'}}
62 #error "invalid arch"
63 #endif
65 #if __is_target_arch ( x86 // expected-error {{unterminated function-like macro invocation}}
66 #error "invalid arch"
67 #endif // expected-error@-2 {{expected value in expression}}