r292119 - Ensure that clang -pthread creates the right macro. -D_POSIX_THREADS
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 16 06:07:25 PST 2017
Author: joerg
Date: Mon Jan 16 08:07:24 2017
New Revision: 292119
URL: http://llvm.org/viewvc/llvm-project?rev=292119&view=rev
Log:
Ensure that clang -pthread creates the right macro. -D_POSIX_THREADS
seems to have been a C&P error from old GCC specs for OpenBSD.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/netbsd.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=292119&r1=292118&r2=292119&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Jan 16 08:07:24 2017
@@ -512,7 +512,7 @@ protected:
Builder.defineMacro("__unix__");
Builder.defineMacro("__ELF__");
if (Opts.POSIXThreads)
- Builder.defineMacro("_POSIX_THREADS");
+ Builder.defineMacro("_REENTRANT");
switch (Triple.getArch()) {
default:
Modified: cfe/trunk/test/Driver/netbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/netbsd.c?rev=292119&r1=292118&r2=292119&view=diff
==============================================================================
--- cfe/trunk/test/Driver/netbsd.c (original)
+++ cfe/trunk/test/Driver/netbsd.c Mon Jan 16 08:07:24 2017
@@ -126,6 +126,8 @@
// RUN: %clang -no-canonical-prefixes -target powerpc64--netbsd -static \
// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=S-POWERPC64 %s
+// RUN: %clang -target x86_64--netbsd -pthread -dM -E %s \
+// RUN: | FileCheck -check-prefix=PTHREAD %s
// STATIC: ld{{.*}}" "--eh-frame-hdr"
// STATIC-NOT: "-pie"
@@ -427,3 +429,7 @@
// S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o"
// S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
// S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
+// PTHREAD-NOT: _POSIX_THREADS
+// PTHREAD: _REENTRANT
+// PTHREAD-NOT: _POSIX_THREADS
More information about the cfe-commits
mailing list