From: Fedor Sergeev Date: Tue, 6 Feb 2018 13:21:12 +0000 (+0000) Subject: [Solaris] Silence -pthread warning on Solaris X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cfe0cc8789aaad2b49983e28661b9db5ab3fb50;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324344 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/Solaris.cpp b/lib/Driver/ToolChains/Solaris.cpp index 3ed286585e..b48edbb08e 100644 --- a/lib/Driver/ToolChains/Solaris.cpp +++ b/lib/Driver/ToolChains/Solaris.cpp @@ -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()) {