r301508 - Darwin: Define __STDC_NO_THREADS__ on Darwin targets
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 26 18:47:23 PDT 2017
Author: dexonsmith
Date: Wed Apr 26 20:47:22 2017
New Revision: 301508
URL: http://llvm.org/viewvc/llvm-project?rev=301508&view=rev
Log:
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
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=301508&r1=301507&r2=301508&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Apr 26 20:47:22 2017
@@ -117,6 +117,7 @@ static void getDarwinDefines(MacroBuilde
VersionTuple &PlatformMinVersion) {
Builder.defineMacro("__APPLE_CC__", "6000");
Builder.defineMacro("__APPLE__");
+ Builder.defineMacro("__STDC_NO_THREADS__");
Builder.defineMacro("OBJC_NEW_PROPERTIES");
// AddressSanitizer doesn't play well with source fortification, which is on
// by default on Darwin.
Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=301508&r1=301507&r2=301508&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Apr 26 20:47:22 2017
@@ -9690,3 +9690,12 @@
// MSVC-X64-NEXT:#define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
// MSVC-X64-NEXT:#define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
// 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
More information about the cfe-commits
mailing list