summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Driver/Tools.cpp4
-rw-r--r--clang/test/Driver/darwin-ld-pthread.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 910b5106e98..1cefce6848c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -8696,6 +8696,10 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// Let the tool chain choose which runtime library to link.
getMachOToolChain().AddLinkRuntimeLibArgs(Args, CmdArgs);
+
+ // No need to do anything for pthreads. Claim argument to avoid warning.
+ Args.ClaimAllArgs(options::OPT_pthread);
+ Args.ClaimAllArgs(options::OPT_pthreads);
}
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
diff --git a/clang/test/Driver/darwin-ld-pthread.c b/clang/test/Driver/darwin-ld-pthread.c
new file mode 100644
index 00000000000..b22b68a6e62
--- /dev/null
+++ b/clang/test/Driver/darwin-ld-pthread.c
@@ -0,0 +1,4 @@
+// RUN: %clang -Wunused-command-line-argument -pthread -target x86_64-apple-darwin -### /dev/null -o /dev/null 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'
OpenPOWER on IntegriCloud