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>
diff --git a/src/runtime/testdata/testprogcgo/panic.c b/src/runtime/testdata/testprogcgo/panic.c
new file mode 100644
index 0000000..deb5ed5
--- /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 4ddef3a..57ac895 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"