]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: ensure the command passed to run retains a trailing dash
authorIan Lance Taylor <iant@golang.org>
Wed, 19 Dec 2018 15:03:04 +0000 (07:03 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 19 Dec 2018 15:47:36 +0000 (15:47 +0000)
This was accidentally broken by CL 127755.

Fixes #29333

Change-Id: I5e92048c64a55c1699d6c38eb4dbbd51c817b820
Reviewed-on: https://go-review.googlesource.com/c/155037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/cgo/test/issue4339.go
src/cmd/cgo/gcc.go

index 4fa4b2bbd7e3c6bb2d357d89b97e923d9d311902..3715fde57573a1bfd065ded8f83c3d26283eb768 100644 (file)
@@ -5,7 +5,8 @@
 package cgotest
 
 /*
-#include "issue4339.h"
+// We've historically permitted #include <>, so test it here.  Issue 29333.
+#include <issue4339.h>
 */
 import "C"
 
index 27bd59b54e0cc72d4126feba4c51db52ea5820a5..11c3ff3a9ceae56fc446505fc8cabf4b4c62c2e6 100644 (file)
@@ -1992,8 +1992,10 @@ func (p *Package) gccErrors(stdin []byte) string {
                }
        }
 
-       // Force -O0 optimization
+       // Force -O0 optimization but keep the trailing "-" at the end.
        nargs = append(nargs, "-O0")
+       nl := len(nargs)
+       nargs[nl-2], nargs[nl-1] = nargs[nl-1], nargs[nl-2]
 
        if *debugGcc {
                fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(nargs, " "))