Skip to content

Commit 51e92d7

Browse files
4a6f656cianlancetaylor
authored andcommitted
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 <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 44e86be commit 51e92d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,10 +3173,12 @@ func (b *Builder) ccompilerCmd(envvar, defcmd, objdir string) []string {
31733173
}
31743174
}
31753175

3176-
if strings.Contains(a[0], "clang") {
3177-
// disable ASCII art in clang errors, if possible
3176+
// disable ASCII art in clang errors, if possible
3177+
if b.gccSupportsFlag("-fno-caret-diagnostics") {
31783178
a = append(a, "-fno-caret-diagnostics")
3179-
// clang is too smart about command-line arguments
3179+
}
3180+
// clang is too smart about command-line arguments
3181+
if b.gccSupportsFlag("-Qunused-arguments") {
31803182
a = append(a, "-Qunused-arguments")
31813183
}
31823184

0 commit comments

Comments
 (0)