aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/errors
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2017-06-05 09:06:30 +0900
committerIan Lance Taylor <iant@golang.org>2017-08-14 05:29:11 +0000
commitb88e532a9ec5aa023c88c64bfaa1ded22bb4c963 (patch)
tree5f5774ccd582c652afa9b58133d1f03ca83890c9 /misc/cgo/errors
parent5b43bbe63b6dfe36f793f496a0e92a3804df0137 (diff)
downloadgo-b88e532a9ec5aa023c88c64bfaa1ded22bb4c963.tar.xz
cmd/cgo: use first error position instead of last one
Just like https://golang.org/cl/34783 Given cgo.go: 1 package main 2 3 /* 4 long double x = 0; 5 */ 6 import "C" 7 8 func main() { 9 _ = C.x 10 _ = C.x 11 } Before: ./cgo.go:10:6: unexpected: 16-byte float type - long double After: ./cgo.go:9:6: unexpected: 16-byte float type - long double The above test case is not portable. So it is tested on only amd64. Change-Id: If0b84cf73d381a22e2ada71c8e9a6e6ec77ffd2e Reviewed-on: https://go-review.googlesource.com/54950 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc/cgo/errors')
-rw-r--r--misc/cgo/errors/err4.go15
-rwxr-xr-xmisc/cgo/errors/test.bash3
2 files changed, 18 insertions, 0 deletions
diff --git a/misc/cgo/errors/err4.go b/misc/cgo/errors/err4.go
new file mode 100644
index 0000000000..8e5f78e987
--- /dev/null
+++ b/misc/cgo/errors/err4.go
@@ -0,0 +1,15 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+/*
+long double x = 0;
+*/
+import "C"
+
+func main() {
+ _ = C.x // ERROR HERE
+ _ = C.x
+}
diff --git a/misc/cgo/errors/test.bash b/misc/cgo/errors/test.bash
index ed0b094692..04747a6913 100755
--- a/misc/cgo/errors/test.bash
+++ b/misc/cgo/errors/test.bash
@@ -37,6 +37,9 @@ expect() {
check err1.go
check err2.go
check err3.go
+if [ $(go env GOARCH) == "amd64" ]; then # If we find a portable test case, we can remove this.
+ check err4.go
+fi
check issue7757.go
check issue8442.go
check issue11097a.go