]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/testdata/testprogcgo: fix TestCgoPanicCallback
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 27 Oct 2021 18:55:10 +0000 (01:55 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 27 Oct 2021 20:29:07 +0000 (20:29 +0000)
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>
src/runtime/testdata/testprogcgo/panic.c [new file with mode: 0644]
src/runtime/testdata/testprogcgo/panic.go

diff --git a/src/runtime/testdata/testprogcgo/panic.c b/src/runtime/testdata/testprogcgo/panic.c
new file mode 100644 (file)
index 0000000..deb5ed5
--- /dev/null
@@ -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();
+}
index 4ddef3abcde4e39f6dc6df02ab5d3fc7cf15af59..57ac89540ec0151569bbad48e6b42b223bf1df5c 100644 (file)
@@ -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"