From: Joel Sing Date: Thu, 31 Aug 2017 17:14:38 +0000 (+1000) Subject: cmd/go: fix clang option handling X-Git-Tag: go1.10beta1~1239 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=51e92d7261ac99ded0b2ad06fe01e71586cbd2bf;p=gostls13.git cmd/go: fix clang option handling 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 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 9a1204866e..2659058931 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -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") }