1
0
mirror of https://github.com/golang/go synced 2024-11-19 22:04:44 -07:00

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 <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Joel Sing 2017-09-01 03:14:38 +10:00 committed by Ian Lance Taylor
parent 44e86bef06
commit 51e92d7261

View 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")
}