Clang Project

clang_source_code/test/Preprocessor/is_target_os_darwin.c
1// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macos -DMAC -verify %s
2// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-ios -verify %s
3// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-tvos -verify %s
4// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-watchos -verify %s
5// expected-no-diagnostics
6
7#if !__is_target_os(darwin)
8  #error "mismatching os"
9#endif
10
11// macOS matches both macOS and macOSX.
12#ifdef MAC
13
14#if !__is_target_os(macos)
15  #error "mismatching os"
16#endif
17
18#if !__is_target_os(macosx)
19  #error "mismatching os"
20#endif
21
22#if __is_target_os(ios)
23  #error "mismatching os"
24#endif
25
26#endif
27