]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/test: tweak to pass with GCC 10
authorIan Lance Taylor <iant@golang.org>
Fri, 13 Dec 2019 01:00:08 +0000 (17:00 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 20 Dec 2019 20:12:18 +0000 (20:12 +0000)
The test for issue 8945 was marked to only run on gccgo, but there was
no reason for that. It broke for gccgo using GCC 10, because GCC 10
defaults to -fno-common. Make the test run on gc, and split it into
test.go and testx.go to make it work with GCC 10.

The test for issue 9026 used two identical structs which GCC 10 turns
into the same type. The point of the test is not that the structs are
identical, but that they are handled in a particular order. So make
them different.

Updates #8945
Updates #9026

Change-Id: I000fb02f88f346cfbbe5dbefedd944a2c64e8d8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/211217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
misc/cgo/test/issue8945.go [deleted file]
misc/cgo/test/test.go
misc/cgo/test/testdata/issue9026/issue9026.go
misc/cgo/test/testx.go

diff --git a/misc/cgo/test/issue8945.go b/misc/cgo/test/issue8945.go
deleted file mode 100644 (file)
index 57a5b2d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2014 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.
-
-// +build gccgo
-
-package cgotest
-
-//typedef void (*PFunc)();
-//PFunc success_cb;
-import "C"
-
-//export Test
-func Test() {
-       _ = C.success_cb
-}
index 68bfa9082545ffd2ca60749319e4a67710976fa2..b0148995fe567cc861b8807487fe79227f02e348 100644 (file)
@@ -562,6 +562,11 @@ void issue8811Execute() {
                issue8811Init();
 }
 
+// issue 8945
+
+typedef void (*PFunc8945)();
+PFunc8945 func8945;
+
 // issue 9557
 
 struct issue9557_t {
index 0af86e64da487a44bc342f8c3bfd1aeea8d465fb..ff269ca9eb099317299f198176ad0882cc44b28f 100644 (file)
@@ -4,9 +4,9 @@ package issue9026
 // per-package counter used to create fresh identifiers.
 
 /*
-typedef struct {} git_merge_file_input;
+typedef struct { int i; } git_merge_file_input;
 
-typedef struct {} git_merge_file_options;
+typedef struct { int j; } git_merge_file_options;
 
 void git_merge_file(
         git_merge_file_input *in,
index bb1b50802b61e2a11a7dad30b0a278aca7b7e308..42979b5f4d5092e3771c828faa2fdecbd0fb5f6d 100644 (file)
@@ -102,6 +102,11 @@ static void issue7978c(uint32_t *sync) {
 // #include'd twice.  No runtime test; just make sure it compiles.
 #include "issue8331.h"
 
+// issue 8945
+
+typedef void (*PFunc8945)();
+extern PFunc8945 func8945; // definition is in test.go
+
 // issue 20910
 void callMulti(void);
 
@@ -514,6 +519,13 @@ func test7978(t *testing.T) {
 
 var issue8331Var C.issue8331
 
+// issue 8945
+
+//export Test8945
+func Test8945() {
+       _ = C.func8945
+}
+
 // issue 20910
 
 //export multi