aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-11-07 08:19:19 -0800
committerIan Lance Taylor <iant@golang.org>2014-11-07 08:19:19 -0800
commit1340c6d59303e0acaab6a50cb39a7c978e25f11b (patch)
tree3350b02443ad9c258918fb698933d4cc736bb24f
parentec7f33300f7fb35ad30e37399126b61b4ca8052a (diff)
downloadgo-1340c6d59303e0acaab6a50cb39a7c978e25f11b.tar.gz
go-1340c6d59303e0acaab6a50cb39a7c978e25f11b.zip
cmd/go: disable warnings from cmd/cc when building for SWIG
Fixes #9065. LGTM=rsc R=rsc, misch CC=golang-codereviews https://golang.org/cl/171270043
-rw-r--r--src/cmd/go/build.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 79a27116a1..1dd4314da6 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -1826,7 +1826,15 @@ func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action,
func (gcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
inc := filepath.Join(goroot, "pkg", fmt.Sprintf("%s_%s", goos, goarch))
cfile = mkAbs(p.Dir, cfile)
- args := stringList(tool(archChar+"c"), "-F", "-V", "-w", "-trimpath", b.work, "-I", objdir, "-I", inc, "-o", ofile, buildCcflags, "-D", "GOOS_"+goos, "-D", "GOARCH_"+goarch, cfile)
+ warn := []string{"-w"}
+ if p.usesSwig() {
+ // When using SWIG, this compiler is only used to
+ // compile the C files generated by SWIG.
+ // We don't want warnings.
+ // See issue 9065 for details.
+ warn = nil
+ }
+ args := stringList(tool(archChar+"c"), "-F", "-V", warn, "-trimpath", b.work, "-I", objdir, "-I", inc, "-o", ofile, buildCcflags, "-D", "GOOS_"+goos, "-D", "GOARCH_"+goarch, cfile)
return b.run(p.Dir, p.ImportPath, nil, args)
}