annotate clang/test/Preprocessor/is_target.c @ 237:c80f45b162ad llvm-original

add some fix
author kono
date Wed, 09 Nov 2022 17:47:54 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin-simulator -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #if !__is_target_arch(x86_64) || !__is_target_arch(X86_64)
anatofuz
parents:
diff changeset
4 #error "mismatching arch"
anatofuz
parents:
diff changeset
5 #endif
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 #if __is_target_arch(arm64)
anatofuz
parents:
diff changeset
8 #error "mismatching arch"
anatofuz
parents:
diff changeset
9 #endif
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // Silently ignore invalid archs. This will ensure that older compilers will
anatofuz
parents:
diff changeset
12 // accept headers that support new arches/vendors/os variants.
anatofuz
parents:
diff changeset
13 #if __is_target_arch(foo)
anatofuz
parents:
diff changeset
14 #error "invalid arch"
anatofuz
parents:
diff changeset
15 #endif
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 #if !__is_target_vendor(apple) || !__is_target_vendor(APPLE)
anatofuz
parents:
diff changeset
18 #error "mismatching vendor"
anatofuz
parents:
diff changeset
19 #endif
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 #if __is_target_vendor(unknown)
anatofuz
parents:
diff changeset
22 #error "mismatching vendor"
anatofuz
parents:
diff changeset
23 #endif
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 #if __is_target_vendor(foo)
anatofuz
parents:
diff changeset
26 #error "invalid vendor"
anatofuz
parents:
diff changeset
27 #endif
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 #if !__is_target_os(darwin) || !__is_target_os(DARWIN)
anatofuz
parents:
diff changeset
30 #error "mismatching os"
anatofuz
parents:
diff changeset
31 #endif
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 #if __is_target_os(ios)
anatofuz
parents:
diff changeset
34 #error "mismatching os"
anatofuz
parents:
diff changeset
35 #endif
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 #if __is_target_os(foo)
anatofuz
parents:
diff changeset
38 #error "invalid os"
anatofuz
parents:
diff changeset
39 #endif
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 #if !__is_target_environment(simulator) || !__is_target_environment(SIMULATOR)
anatofuz
parents:
diff changeset
42 #error "mismatching environment"
anatofuz
parents:
diff changeset
43 #endif
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 #if __is_target_environment(unknown)
anatofuz
parents:
diff changeset
46 #error "mismatching environment"
anatofuz
parents:
diff changeset
47 #endif
anatofuz
parents:
diff changeset
48
anatofuz
parents:
diff changeset
49 #if __is_target_environment(foo)
anatofuz
parents:
diff changeset
50 #error "invalid environment"
anatofuz
parents:
diff changeset
51 #endif
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 #if !__has_builtin(__is_target_arch) || !__has_builtin(__is_target_os) || !__has_builtin(__is_target_vendor) || !__has_builtin(__is_target_environment)
anatofuz
parents:
diff changeset
54 #error "has builtin doesn't work"
anatofuz
parents:
diff changeset
55 #endif
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 #if __is_target_arch(11) // expected-error {{builtin feature check macro requires a parenthesized identifier}}
anatofuz
parents:
diff changeset
58 #error "invalid arch"
anatofuz
parents:
diff changeset
59 #endif
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 #if __is_target_arch x86 // expected-error{{missing '(' after '__is_target_arch'}}
anatofuz
parents:
diff changeset
62 #error "invalid arch"
anatofuz
parents:
diff changeset
63 #endif
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 #if __is_target_arch ( x86 // expected-error {{unterminated function-like macro invocation}}
anatofuz
parents:
diff changeset
66 #error "invalid arch"
anatofuz
parents:
diff changeset
67 #endif // expected-error@-2 {{expected value in expression}}