MatzeB created this revision. Herald added a subscriber: mcrosier. While there is nothing to do at link time to get pthreads support on darwin, specifying -pthread is fine and should not produce a warning about unused arguments.
Repository: rL LLVM https://reviews.llvm.org/D29479 Files: lib/Driver/Tools.cpp test/Driver/darwin-ld-pthread.c Index: test/Driver/darwin-ld-pthread.c =================================================================== --- /dev/null +++ test/Driver/darwin-ld-pthread.c @@ -0,0 +1,5 @@ +// RUN: %clang -target x86_64-apple-darwin -c -o %t.o %s +// RUN: %clang -Wunused-command-line-argument -pthread -target x86_64-apple-darwin -### %t.o -o %t.bin 2>&1 | FileCheck %s + +// There is nothing to do at link time to get pthread support. But do not warn. +// CHECK-NOT: argument unused during compilation: '-pthread' Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -8718,6 +8718,9 @@ } } + // No need to do anything for pthreads. Claim argument to avoid warning. + Args.ClaimAllArgs(options::OPT_pthread); + const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); std::unique_ptr<Command> Cmd = llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs);
Index: test/Driver/darwin-ld-pthread.c =================================================================== --- /dev/null +++ test/Driver/darwin-ld-pthread.c @@ -0,0 +1,5 @@ +// RUN: %clang -target x86_64-apple-darwin -c -o %t.o %s +// RUN: %clang -Wunused-command-line-argument -pthread -target x86_64-apple-darwin -### %t.o -o %t.bin 2>&1 | FileCheck %s + +// There is nothing to do at link time to get pthread support. But do not warn. +// CHECK-NOT: argument unused during compilation: '-pthread' Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -8718,6 +8718,9 @@ } } + // No need to do anything for pthreads. Claim argument to avoid warning. + Args.ClaimAllArgs(options::OPT_pthread); + const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); std::unique_ptr<Command> Cmd = llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits