summaryrefslogtreecommitdiffstats
path: root/misc/cgo/test/testdata/gcc68255
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 13:14:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 13:14:23 +0000
commit73df946d56c74384511a194dd01dbe099584fd1a (patch)
treefd0bcea490dd81327ddfbb31e215439672c9a068 /misc/cgo/test/testdata/gcc68255
parentInitial commit. (diff)
downloadgolang-1.16-upstream.tar.xz
golang-1.16-upstream.zip
Adding upstream version 1.16.10.upstream/1.16.10upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'misc/cgo/test/testdata/gcc68255')
-rw-r--r--misc/cgo/test/testdata/gcc68255/a.go17
-rw-r--r--misc/cgo/test/testdata/gcc68255/c.c8
-rw-r--r--misc/cgo/test/testdata/gcc68255/c.h5
3 files changed, 30 insertions, 0 deletions
diff --git a/misc/cgo/test/testdata/gcc68255/a.go b/misc/cgo/test/testdata/gcc68255/a.go
new file mode 100644
index 0000000..e106dee
--- /dev/null
+++ b/misc/cgo/test/testdata/gcc68255/a.go
@@ -0,0 +1,17 @@
+// Copyright 2015 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.
+
+// Test that it's OK to have C code that does nothing other than
+// initialize a global variable. This used to fail with gccgo.
+
+package gcc68255
+
+/*
+#include "c.h"
+*/
+import "C"
+
+func F() bool {
+ return C.v != nil
+}
diff --git a/misc/cgo/test/testdata/gcc68255/c.c b/misc/cgo/test/testdata/gcc68255/c.c
new file mode 100644
index 0000000..a4fe193
--- /dev/null
+++ b/misc/cgo/test/testdata/gcc68255/c.c
@@ -0,0 +1,8 @@
+// Copyright 2015 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.
+
+static void f(void) {
+}
+
+void (*v)(void) = f;
diff --git a/misc/cgo/test/testdata/gcc68255/c.h b/misc/cgo/test/testdata/gcc68255/c.h
new file mode 100644
index 0000000..05ecd81
--- /dev/null
+++ b/misc/cgo/test/testdata/gcc68255/c.h
@@ -0,0 +1,5 @@
+// Copyright 2015 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.
+
+extern void (*v)(void);