From 51e92d7261ac99ded0b2ad06fe01e71586cbd2bf Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Fri, 1 Sep 2017 03:14:38 +1000 Subject: [PATCH] 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 --- src/cmd/go/internal/work/build.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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") } -- 2.50.0