From 29673a4be6770422774968a287e87bf7c8330497 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 19 Jun 2018 16:55:19 -0700 Subject: [PATCH] misc/cgo/test: avoid duplicate definition with gccgo Current versions of gccgo issue a duplicate definition error when both a definition and an empty declaration occur. Use build tags to avoid that case for the issue9400 subdirectory. Change-Id: I18517af87bab05e9ca43f2f295459cf34347c317 Reviewed-on: https://go-review.googlesource.com/119896 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- misc/cgo/test/issue9400/gccgo.go | 2 ++ misc/cgo/test/issue9400/stubs.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/misc/cgo/test/issue9400/gccgo.go b/misc/cgo/test/issue9400/gccgo.go index 0ef3a8cacf..a9b62b07a0 100644 --- a/misc/cgo/test/issue9400/gccgo.go +++ b/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/misc/cgo/test/issue9400/stubs.go b/misc/cgo/test/issue9400/stubs.go index 60193dc411..e431c5a28a 100644 --- a/misc/cgo/test/issue9400/stubs.go +++ b/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 gc + package issue9400 var Baton int32 -- 2.50.0