Skip to content

Commit d9e2ba4

Browse files
cmd/cgo: ensure the command passed to run retains a trailing dash
This was accidentally broken by CL 127755. Fixes golang#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>
1 parent d902f23 commit d9e2ba4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

misc/cgo/test/issue4339.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
package cgotest
66

77
/*
8-
#include "issue4339.h"
8+
// We've historically permitted #include <>, so test it here. Issue 29333.
9+
#include <issue4339.h>
910
*/
1011
import "C"
1112

src/cmd/cgo/gcc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,10 @@ func (p *Package) gccErrors(stdin []byte) string {
19921992
}
19931993
}
19941994

1995-
// Force -O0 optimization
1995+
// Force -O0 optimization but keep the trailing "-" at the end.
19961996
nargs = append(nargs, "-O0")
1997+
nl := len(nargs)
1998+
nargs[nl-2], nargs[nl-1] = nargs[nl-1], nargs[nl-2]
19971999

19982000
if *debugGcc {
19992001
fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(nargs, " "))

0 commit comments

Comments
 (0)