[PATCH] D41242: [Solaris] Silence -pthread warning on Solaris

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


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

During make check-all on Solaris, I see several instances of this warning:

clang-6.0: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

Since Solaris 10, libpthread has been folded into libc, so there's nothing to do.  gcc
just ignores -pthread here.  Darwin claims the option to silence the warning, and
this patch follows that lead.


Repository:
  rC Clang

https://reviews.llvm.org/D41242

Files:
  lib/Driver/ToolChains/Solaris.cpp


Index: lib/Driver/ToolChains/Solaris.cpp
===================================================================
--- lib/Driver/ToolChains/Solaris.cpp
+++ lib/Driver/ToolChains/Solaris.cpp
@@ -71,6 +71,11 @@
       CmdArgs.push_back(
           Args.MakeArgString(getToolChain().GetFilePath("ld.so.1")));
     }
+
+    // libpthread has been folded into libc since Solaris 10, no need to do
+    // anything for pthreads. Claim argument to avoid warning.
+    Args.ClaimAllArgs(options::OPT_pthread);
+    Args.ClaimAllArgs(options::OPT_pthreads);
   }
 
   if (Output.isFilename()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41242.126963.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171214/60a51ddf/attachment.bin>


More information about the cfe-commits mailing list