Darwin: Define __STDC_NO_THREADS__ on Darwin targets

Darwin doesn't support C11 threads.h.  Define `__STDC_NO_THREADS__` so
that users can check for it.

rdar://problem/18461003

llvm-svn: 301508
This commit is contained in:
Duncan P. N. Exon Smith 2017-04-27 01:47:22 +00:00
parent 8c8fb80490
commit 16b1ac950b
2 changed files with 10 additions and 0 deletions

View File

@ -117,6 +117,7 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
VersionTuple &PlatformMinVersion) { VersionTuple &PlatformMinVersion) {
Builder.defineMacro("__APPLE_CC__", "6000"); Builder.defineMacro("__APPLE_CC__", "6000");
Builder.defineMacro("__APPLE__"); Builder.defineMacro("__APPLE__");
Builder.defineMacro("__STDC_NO_THREADS__");
Builder.defineMacro("OBJC_NEW_PROPERTIES"); Builder.defineMacro("OBJC_NEW_PROPERTIES");
// AddressSanitizer doesn't play well with source fortification, which is on // AddressSanitizer doesn't play well with source fortification, which is on
// by default on Darwin. // by default on Darwin.

View File

@ -9690,3 +9690,12 @@
// MSVC-X64-NEXT:#define __CLANG_ATOMIC_SHORT_LOCK_FREE 2 // MSVC-X64-NEXT:#define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
// MSVC-X64-NEXT:#define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2 // MSVC-X64-NEXT:#define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
// MSVC-X86-NOT:#define __GCC_ATOMIC{{.*}} // MSVC-X86-NOT:#define __GCC_ATOMIC{{.*}}
// RUN: %clang_cc1 -E -dM -ffreestanding \
// RUN: -triple=aarch64-apple-ios9 < /dev/null \
// RUN: | FileCheck -check-prefix=DARWIN %s
// RUN: %clang_cc1 -E -dM -ffreestanding \
// RUN: -triple=aarch64-apple-macosx10.12 < /dev/null \
// RUN: | FileCheck -check-prefix=DARWIN %s
// DARWIN:#define __STDC_NO_THREADS__ 1