mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: more robust detection of clang
Fixes #10453. Change-Id: I77470279865d4c954df615d6594c69edf68c28ca Reviewed-on: https://go-review.googlesource.com/9090 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
05efc18c20
commit
93402383ea
3 changed files with 7 additions and 2 deletions
|
|
@ -199,6 +199,10 @@ func (p *Package) loadDefines(f *File) {
|
|||
val = strings.TrimSpace(line[tabIndex:])
|
||||
}
|
||||
|
||||
if key == "__clang__" {
|
||||
p.GccIsClang = true
|
||||
}
|
||||
|
||||
if n := f.Name[key]; n != nil {
|
||||
if *debugDefine {
|
||||
fmt.Fprintf(os.Stderr, "#define %s %s\n", key, val)
|
||||
|
|
@ -762,7 +766,7 @@ func (p *Package) gccCmd() []string {
|
|||
"-c", // do not link
|
||||
"-xc", // input language is C
|
||||
)
|
||||
if strings.Contains(c[0], "clang") {
|
||||
if p.GccIsClang {
|
||||
c = append(c,
|
||||
"-ferror-limit=0",
|
||||
// Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue