]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.1] cmd/cgo: pass -Wsystem-headers when looking for errors
authorAndrew Gerrand <adg@golang.org>
Wed, 8 May 2013 23:00:15 +0000 (16:00 -0700)
committerAndrew Gerrand <adg@golang.org>
Wed, 8 May 2013 23:00:15 +0000 (16:00 -0700)
««« CL 9120045 / e4f62df3e6c9
cmd/cgo: pass -Wsystem-headers when looking for errors

This works around a bug in GCC 4.8.0.

Fixes #5118.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/9120045
»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9259047

src/cmd/cgo/gcc.go

index 8288a490ac739f615d007d4e87f3ddbdcea867a0..bc7a6472f38675c79beb9a87ed076fd44c172e73 100644 (file)
@@ -809,6 +809,15 @@ func (p *Package) gccDefines(stdin []byte) string {
 func (p *Package) gccErrors(stdin []byte) string {
        // TODO(rsc): require failure
        args := p.gccCmd()
+
+       // GCC 4.8.0 has a bug: it sometimes does not apply
+       // -Wunused-value to values that are macros defined in system
+       // headers.  See issue 5118.  Adding -Wsystem-headers avoids
+       // that problem.  This will produce additional errors, but it
+       // doesn't matter because we will ignore all errors that are
+       // not marked for the cgo-test file.
+       args = append(args, "-Wsystem-headers")
+
        if *debugGcc {
                fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(args, " "))
                os.Stderr.Write(stdin)