[PATCH] D43614: Define _PTHREADS for -pthread on NetBSD

Kamil Rytarowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 02:43:46 PST 2018


krytarowski created this revision.
krytarowski added reviewers: joerg, rnk.
krytarowski added a project: clang.
Herald added a subscriber: llvm-commits.

GCC and PCC define _PTHREADS for -pthreads
on NetBSD.

The _PTHREADS preprocessor macro is used in
the NetBSD header in <stdio.h>.

NetBSD uses both: _REENTRANT and _PTHREAD
for the -pthreads command line option.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D43614

Files:
  lib/Basic/Targets/OSTargets.h
  test/Driver/netbsd.c


Index: test/Driver/netbsd.c
===================================================================
--- test/Driver/netbsd.c
+++ test/Driver/netbsd.c
@@ -431,5 +431,6 @@
 // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
 
 // PTHREAD-NOT: _POSIX_THREADS
+// PTHREAD:     _PTHREADS
 // PTHREAD:     _REENTRANT
 // PTHREAD-NOT: _POSIX_THREADS
Index: lib/Basic/Targets/OSTargets.h
===================================================================
--- lib/Basic/Targets/OSTargets.h
+++ lib/Basic/Targets/OSTargets.h
@@ -362,8 +362,10 @@
     Builder.defineMacro("__NetBSD__");
     Builder.defineMacro("__unix__");
     Builder.defineMacro("__ELF__");
-    if (Opts.POSIXThreads)
+    if (Opts.POSIXThreads) {
       Builder.defineMacro("_REENTRANT");
+      Builder.defineMacro("_PTHREADS");
+    }
   }
 
 public:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43614.135380.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180222/2f7b5cf5/attachment.bin>


More information about the cfe-commits mailing list