]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix clang option handling
authorJoel Sing <joel@sing.id.au>
Thu, 31 Aug 2017 17:14:38 +0000 (03:14 +1000)
committerIan Lance Taylor <iant@golang.org>
Fri, 1 Sep 2017 00:31:15 +0000 (00:31 +0000)
On OpenBSD -current, clang is available/installed as 'cc'. This means that
the existing clang check fails and the clang related flags are not enabled.
Fix this by enabling the clang flags if the compiler claims to support them.

Change-Id: I84d124d2409a10f87002c6cbfdb69b4c9a55981a
Reviewed-on: https://go-review.googlesource.com/60750
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/internal/work/build.go

index 9a1204866e11148e99e5b49f778c0c71f55000a2..2659058931f9304f4f2dc2ba48a5383405d6ca6f 100644 (file)
@@ -3173,10 +3173,12 @@ func (b *Builder) ccompilerCmd(envvar, defcmd, objdir string) []string {
                }
        }
 
-       if strings.Contains(a[0], "clang") {
-               // disable ASCII art in clang errors, if possible
+       // disable ASCII art in clang errors, if possible
+       if b.gccSupportsFlag("-fno-caret-diagnostics") {
                a = append(a, "-fno-caret-diagnostics")
-               // clang is too smart about command-line arguments
+       }
+       // clang is too smart about command-line arguments
+       if b.gccSupportsFlag("-Qunused-arguments") {
                a = append(a, "-Qunused-arguments")
        }