diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-12 19:29:52 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-12 19:29:52 +0000 |
commit | 52eb4ab4092228369cea5d7ca2717d32cc666c5c (patch) | |
tree | 48902ea09d6ebb6b6a26f1aa463e3e48e00381a0 /libgo/misc/cgo | |
parent | 86ff185365dbc40b64f907be9e2f35d756776e20 (diff) | |
download | gcc-52eb4ab4092228369cea5d7ca2717d32cc666c5c.zip gcc-52eb4ab4092228369cea5d7ca2717d32cc666c5c.tar.gz gcc-52eb4ab4092228369cea5d7ca2717d32cc666c5c.tar.bz2 |
compiler: error on func declaration/definition
Long long long ago Go permitted writing
func F()
in one file and writing
func F() {}
in another file. This was removed from the language, and that is now
considered to be a multiple definition error. Gccgo never caught up
to that, and it has been permitting this invalid code for some time.
Stop permitting it, so that we give correct errors. Since we've
supported it for a long time, the compiler uses it in a couple of
cases: it predeclares the hash/equal methods if it decides to create
them while compiling another function, and it predeclares main.main as
a mechanism for getting the right warning if a program uses the wrong
signature for main. For simplicity, keep those existing uses.
This required a few minor changes in libgo which were relying,
unnecessarily, on the current behavior.
Reviewed-on: https://go-review.googlesource.com/93083
From-SVN: r257600
Diffstat (limited to 'libgo/misc/cgo')
-rw-r--r-- | libgo/misc/cgo/test/issue9400/gccgo.go | 2 | ||||
-rw-r--r-- | libgo/misc/cgo/test/issue9400/stubs.go | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/libgo/misc/cgo/test/issue9400/gccgo.go b/libgo/misc/cgo/test/issue9400/gccgo.go index 0ef3a8c..a9b62b0 100644 --- a/libgo/misc/cgo/test/issue9400/gccgo.go +++ b/libgo/misc/cgo/test/issue9400/gccgo.go @@ -16,6 +16,8 @@ import ( // without writing more assembly code, which we haven't bothered to // do. So this is not much of a test. +var Baton int32 + func RewindAndSetgid() { atomic.StoreInt32(&Baton, 1) for atomic.LoadInt32(&Baton) != 0 { diff --git a/libgo/misc/cgo/test/issue9400/stubs.go b/libgo/misc/cgo/test/issue9400/stubs.go index 60193dc..7b50cef 100644 --- a/libgo/misc/cgo/test/issue9400/stubs.go +++ b/libgo/misc/cgo/test/issue9400/stubs.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !gccgo + package issue9400 var Baton int32 |