aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2013-09-03 21:15:15 -0700
committerIan Lance Taylor <iant@golang.org>2013-09-03 21:15:15 -0700
commitf68c23e2bba617d8f9bbe1cb53a920aeaf8901ad (patch)
tree0f91d00295700581344c67109e79c795cee6be3c /src
parent0ba7ffe2897cd9771de172362e9edcb5f733cf1f (diff)
downloadgo-f68c23e2bba617d8f9bbe1cb53a920aeaf8901ad.tar.xz
cmd/cgo: don't let #cgo directives mess up line numbering
Fixes #5272. R=golang-dev, r CC=golang-dev https://golang.org/cl/13498046
Diffstat (limited to 'src')
-rw-r--r--src/cmd/cgo/gcc.go2
-rwxr-xr-xsrc/run.bash6
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index f470094663..d835accac1 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -76,6 +76,8 @@ func (f *File) DiscardCgoDirectives() {
l := strings.TrimSpace(line)
if len(l) < 5 || l[:4] != "#cgo" || !unicode.IsSpace(rune(l[4])) {
linesOut = append(linesOut, line)
+ } else {
+ linesOut = append(linesOut, "")
}
}
f.Preamble = strings.Join(linesOut, "\n")
diff --git a/src/run.bash b/src/run.bash
index 52e09b4979..9af3f95b07 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -145,6 +145,12 @@ esac
go run main.go || exit 1
) || exit $?
+[ "$CGO_ENABLED" != 1 ] ||
+[ "$GOHOSTOS" == windows ] ||
+(xcd ../misc/cgo/errors
+./test.bash || exit 1
+) || exit $?
+
(xcd ../doc/progs
time ./run || exit 1
) || exit $?