]> granicus.if.org Git - clang/commitdiff
[Solaris] Silence -pthread warning on Solaris
authorFedor Sergeev <fedor.sergeev@azul.com>
Tue, 6 Feb 2018 13:21:12 +0000 (13:21 +0000)
committerFedor Sergeev <fedor.sergeev@azul.com>
Tue, 6 Feb 2018 13:21:12 +0000 (13:21 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324344 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Solaris.cpp

index 3ed286585e0fe9ecf82bbfe6c8d21d1ff4003d30..b48edbb08ee6cf08b94d9c44807cf2b3feba5f70 100644 (file)
@@ -71,6 +71,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
       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()) {