From: Brad Fitzpatrick Date: Tue, 10 May 2016 20:03:42 +0000 (-0700) Subject: cmd/go: make C compiler warnings fatal on builders X-Git-Tag: go1.8beta1~1577 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b6e3a98cf3a7acb3d5c1431eb04e9c3edad6c6ed;p=gostls13.git cmd/go: make C compiler warnings fatal on builders Fixes #14698 Change-Id: I82fa781bf136c30e900d8e910ff576ba8b218acb Reviewed-on: https://go-review.googlesource.com/23005 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index e19cc5d38b..6e7f54d996 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -3000,9 +3000,19 @@ func (b *builder) gfortran(p *Package, out string, flags []string, ffile string) } // ccompile runs the given C or C++ compiler and creates an object from a single source file. -func (b *builder) ccompile(p *Package, out string, flags []string, file string, compiler []string) error { +func (b *builder) ccompile(p *Package, outfile string, flags []string, file string, compiler []string) error { file = mkAbs(p.Dir, file) - return b.run(p.Dir, p.ImportPath, nil, compiler, flags, "-o", out, "-c", file) + desc := p.ImportPath + output, err := b.runOut(p.Dir, desc, nil, compiler, flags, "-o", outfile, "-c", file) + if len(output) > 0 { + b.showOutput(p.Dir, desc, b.processOutput(output)) + if err != nil { + err = errPrintedOutput + } else if os.Getenv("GO_BUILDER_NAME") != "" { + return errors.New("C compiler warning promoted to error on Go builders") + } + } + return err } // gccld runs the gcc linker to create an executable from a set of object files.