[PATCH] D41241: [Solaris] Only define _REENTRANT if -pthread

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 07:48:50 PST 2017


ro created this revision.
ro added a reviewer: rsmith.
Herald added a subscriber: fedor.sergeev.

When looking at lib/Basic/Targets/OSTargets.h, I noticed that _REENTRANT is defined
unconditionally on Solaris, unlike all other targets and what either Studio cc (only define
it with -mt) or gcc (only define it with -pthread) do.

This patch (on top of https://reviews.llvm.org/D41240) follows that lead.


Repository:
  rC Clang

https://reviews.llvm.org/D41241

Files:
  lib/Basic/Targets/OSTargets.h


Index: lib/Basic/Targets/OSTargets.h
===================================================================
--- lib/Basic/Targets/OSTargets.h
+++ lib/Basic/Targets/OSTargets.h
@@ -544,7 +544,8 @@
     Builder.defineMacro("_LARGEFILE_SOURCE");
     Builder.defineMacro("_LARGEFILE64_SOURCE");
     Builder.defineMacro("__EXTENSIONS__");
-    Builder.defineMacro("_REENTRANT");
+    if (Opts.POSIXThreads)
+      Builder.defineMacro("_REENTRANT");
     if (this->HasFloat128)
       Builder.defineMacro("__FLOAT128__");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41241.126962.patch
Type: text/x-patch
Size: 520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171214/8ea57fd5/attachment.bin>


More information about the cfe-commits mailing list