aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-28 01:55:10 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-27 20:29:07 +0000
commit51be206114b559f7ea26fe2290f8ed274a2080c3 (patch)
tree7fe2dbca6556c9ca16b5064abdd3705e934b73d1 /src/runtime/testdata
parent30a82efcf403fed76bf1542e9477047660d5f54d (diff)
downloadgo-51be206114b559f7ea26fe2290f8ed274a2080c3.tar.xz
runtime/testdata/testprogcgo: fix TestCgoPanicCallback
A cgo file with "//export" declarations is not permitted to have function definitions in the cgo comments. Fixes #49188 Change-Id: I5c24b62b259871473ee984cea96a0edd7d42d23a Reviewed-on: https://go-review.googlesource.com/c/go/+/359195 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprogcgo/panic.c9
-rw-r--r--src/runtime/testdata/testprogcgo/panic.go8
2 files changed, 10 insertions, 7 deletions
diff --git a/src/runtime/testdata/testprogcgo/panic.c b/src/runtime/testdata/testprogcgo/panic.c
new file mode 100644
index 0000000000..deb5ed5a60
--- /dev/null
+++ b/src/runtime/testdata/testprogcgo/panic.c
@@ -0,0 +1,9 @@
+// Copyright 2021 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 panic_callback();
+
+void call_callback(void) {
+ panic_callback();
+}
diff --git a/src/runtime/testdata/testprogcgo/panic.go b/src/runtime/testdata/testprogcgo/panic.go
index 4ddef3abcd..57ac89540e 100644
--- a/src/runtime/testdata/testprogcgo/panic.go
+++ b/src/runtime/testdata/testprogcgo/panic.go
@@ -1,16 +1,10 @@
package main
-import "C"
-
// This program will crash.
// We want to test unwinding from a cgo callback.
/*
-void panic_callback();
-
-static void call_callback(void) {
- panic_callback();
-}
+void call_callback(void);
*/
import "C"