1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin-simulator -verify %s 2 3 #if !__is_target_arch(x86_64) || !__is_target_arch(X86_64) 4 #error "mismatching arch" 5 #endif 6 7 #if __is_target_arch(arm64) 8 #error "mismatching arch" 9 #endif 10 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 16 17 #if !__is_target_vendor(apple) || !__is_target_vendor(APPLE) 18 #error "mismatching vendor" 19 #endif 20 21 #if __is_target_vendor(unknown) 22 #error "mismatching vendor" 23 #endif 24 25 #if __is_target_vendor(foo) 26 #error "invalid vendor" 27 #endif 28 29 #if !__is_target_os(darwin) || !__is_target_os(DARWIN) 30 #error "mismatching os" 31 #endif 32 33 #if __is_target_os(ios) 34 #error "mismatching os" 35 #endif 36 37 #if __is_target_os(foo) 38 #error "invalid os" 39 #endif 40 41 #if !__is_target_environment(simulator) || !__is_target_environment(SIMULATOR) 42 #error "mismatching environment" 43 #endif 44 45 #if __is_target_environment(unknown) 46 #error "mismatching environment" 47 #endif 48 49 #if __is_target_environment(foo) 50 #error "invalid environment" 51 #endif 52 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 56 57 #if __is_target_arch(11) // expected-error {{builtin feature check macro requires a parenthesized identifier}} 58 #error "invalid arch" 59 #endif 60 61 #if __is_target_arch x86 // expected-error{{missing '(' after '__is_target_arch'}} 62 #error "invalid arch" 63 #endif 64 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}} 68