r324344 - [Solaris] Silence -pthread warning on Solaris

Fedor Sergeev via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 05:21:12 PST 2018


Author: fedor.sergeev
Date: Tue Feb  6 05:21:12 2018
New Revision: 324344

URL: http://llvm.org/viewvc/llvm-project?rev=324344&view=rev
Log:
[Solaris] Silence -pthread warning on Solaris

Summary:
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.

Reviewers: rsmith, fedor.sergeev

Reviewed By: fedor.sergeev

Subscribers: cfe-commits, fedor.sergeev

Differential Revision: https://reviews.llvm.org/D41242

Modified:
    cfe/trunk/lib/Driver/ToolChains/Solaris.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Solaris.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Solaris.cpp?rev=324344&r1=324343&r2=324344&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Solaris.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Solaris.cpp Tue Feb  6 05:21:12 2018
@@ -71,6 +71,11 @@ void solaris::Linker::ConstructJob(Compi
       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()) {




More information about the cfe-commits mailing list