[PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-09-26 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB closed this revision.
MatzeB added a comment.

This was accepted on the mailinglist and committed in r294065


Repository:
  rL LLVM

https://reviews.llvm.org/D29479



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-02-03 Thread Duncan P. N. Exon Smith via cfe-commits
LGTM.

> On 2017-Feb-03, at 14:16, Matthias Braun via Phabricator 
>  wrote:
> 
> MatzeB updated this revision to Diff 87024.
> MatzeB added a comment.
> 
> Address review comments:
> 
> - Simplify test
> - Only perform the ClaimAll() if we actually link libc, so we get the warning 
> back when combining -nostdlib/-nodefaultlibs with -pthread
> 
> 
> 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,4 @@
> +// RUN: %clang -Wunused-command-line-argument -pthread -target 
> x86_64-apple-darwin -### /dev/null -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
> @@ -8696,6 +8696,10 @@
> 
> // 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)) {
> 
> 
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-02-03 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB updated this revision to Diff 87024.
MatzeB added a comment.

Address review comments:

- Simplify test
- Only perform the ClaimAll() if we actually link libc, so we get the warning 
back when combining -nostdlib/-nodefaultlibs with -pthread


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,4 @@
+// RUN: %clang -Wunused-command-line-argument -pthread -target 
x86_64-apple-darwin -### /dev/null -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
@@ -8696,6 +8696,10 @@
 
 // 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)) {


Index: test/Driver/darwin-ld-pthread.c
===
--- /dev/null
+++ 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 %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
@@ -8696,6 +8696,10 @@
 
 // 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)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-02-03 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB updated this revision to Diff 87023.

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,4 @@
+// RUN: %clang -Wunused-command-line-argument -pthread -target 
x86_64-apple-darwin -### /dev/null -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,10 @@
 }
   }
 
+  // No need to do anything for pthreads. Claim argument to avoid warning.
+  Args.ClaimAllArgs(options::OPT_pthread);
+  Args.ClaimAllArgs(options::OPT_pthreads);
+
   const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
   std::unique_ptr Cmd =
   llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs);


Index: test/Driver/darwin-ld-pthread.c
===
--- /dev/null
+++ 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 %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,10 @@
 }
   }
 
+  // No need to do anything for pthreads. Claim argument to avoid warning.
+  Args.ClaimAllArgs(options::OPT_pthread);
+  Args.ClaimAllArgs(options::OPT_pthreads);
+
   const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
   std::unique_ptr Cmd =
   llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-02-02 Thread Duncan P. N. Exon Smith via cfe-commits
Seems reasonable to me.

I wonder, should this do something in the case where -nostdlib has been passed, 
so we're not linking against libc by default?  Or should it error/warning/etc.?

One comment inline below.

> On 2017-Feb-02, at 16:56, Matthias Braun via Phabricator 
>  wrote:
> 
> 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

I *think* you can skip this command, and just pass /dev/null as the object file 
to the next driver command.

> +// 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 Cmd =
>   llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs);
> 
> 
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29479: Driver: Do not warn about unused -pthread when linking on darwin

2017-02-02 Thread Matthias Braun via Phabricator via cfe-commits
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 Cmd =
   llvm::make_unique(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 Cmd =
   llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits