aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2018-02-12 19:29:52 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2018-02-12 19:29:52 +0000
commit2d4ecfe257009de1bdaf506487bd49c6fec49885 (patch)
tree48902ea09d6ebb6b6a26f1aa463e3e48e00381a0 /libgo
parentba77fca17780b71bcc94992a7e40130baf6b32ab (diff)
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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257600 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/extern.go4
-rw-r--r--libgo/go/runtime/stubs.go17
-rw-r--r--libgo/misc/cgo/test/issue9400/gccgo.go2
-rw-r--r--libgo/misc/cgo/test/issue9400/stubs.go2
4 files changed, 4 insertions, 21 deletions
diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go
index 36787e38b02..b3afd10ed6d 100644
--- a/libgo/go/runtime/extern.go
+++ b/libgo/go/runtime/extern.go
@@ -157,10 +157,6 @@ package runtime
import "runtime/internal/sys"
-// Gosched yields the processor, allowing other goroutines to run. It does not
-// suspend the current goroutine, so execution resumes automatically.
-func Gosched()
-
// Caller reports file and line number information about function invocations on
// the calling goroutine's stack. The argument skip is the number of stack frames
// to ascend, with 0 identifying the caller of Caller. (For historical reasons the
diff --git a/libgo/go/runtime/stubs.go b/libgo/go/runtime/stubs.go
index efb037399bf..bda2c694ac6 100644
--- a/libgo/go/runtime/stubs.go
+++ b/libgo/go/runtime/stubs.go
@@ -306,10 +306,6 @@ func setSupportAES(v bool) {
support_aes = v
}
-// Here for gccgo until we port lock_*.go.
-func lock(l *mutex)
-func unlock(l *mutex)
-
// Here for gccgo.
func errno() int
@@ -317,9 +313,6 @@ func errno() int
func entersyscall(int32)
func entersyscallblock(int32)
-// Here for gccgo until we port mgc.go.
-func GC()
-
// For gccgo to call from C code, so that the C code and the Go code
// can share the memstats variable for now.
//go:linkname getMstats runtime.getMstats
@@ -327,16 +320,6 @@ func getMstats() *mstats {
return &memstats
}
-// Temporary for gccgo until we port mem_GOOS.go.
-func sysAlloc(n uintptr, sysStat *uint64) unsafe.Pointer
-func sysFree(v unsafe.Pointer, n uintptr, sysStat *uint64)
-
-// Temporary for gccgo until we port malloc.go
-func persistentalloc(size, align uintptr, sysStat *uint64) unsafe.Pointer
-
-// Temporary for gccgo until we port mheap.go
-func setprofilebucket(p unsafe.Pointer, b *bucket)
-
// Get signal trampoline, written in C.
func getSigtramp() uintptr
diff --git a/libgo/misc/cgo/test/issue9400/gccgo.go b/libgo/misc/cgo/test/issue9400/gccgo.go
index 0ef3a8cacf3..a9b62b07a04 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 60193dc4117..7b50cefc3a8 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