aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-05-08 16:00:15 -0700
committerAndrew Gerrand <adg@golang.org>2013-05-08 16:00:15 -0700
commitc785d6af6679554028264c3767015ba2a7ecbe67 (patch)
tree0671c43130864e382d6c3b28318f5a2ca500dfba
parent99aa2da7ea1f82eb8385835e5e7bf293c8da4fb5 (diff)
downloadgo-c785d6af6679554028264c3767015ba2a7ecbe67.tar.gz
go-c785d6af6679554028264c3767015ba2a7ecbe67.zip
[release-branch.go1.1] cmd/cgo: pass -Wsystem-headers when looking for errors
««« 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
-rw-r--r--src/cmd/cgo/gcc.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 8288a490ac..bc7a6472f3 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -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)