]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/test: fix C panic test to work with gccgo
authorIan Lance Taylor <iant@golang.org>
Fri, 11 Oct 2013 18:24:54 +0000 (11:24 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 11 Oct 2013 18:24:54 +0000 (11:24 -0700)
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14611043

misc/cgo/test/callback_c.c
misc/cgo/test/callback_c_gc.c [new file with mode: 0644]
misc/cgo/test/callback_c_gccgo.c [new file with mode: 0644]

index 4bfeb7163e363360c87d2be14fd2ef02382c9fbd..dcd4ddd4ee3b1062df92e3dee3db354b8db0e939 100644 (file)
@@ -64,17 +64,3 @@ callGoStackCheck(void)
        extern void goStackCheck(void);
        goStackCheck();
 }
-
-/* Test calling panic from C.  This is what SWIG does.  */
-
-extern void crosscall2(void (*fn)(void *, int), void *, int);
-extern void _cgo_panic(void *, int);
-
-void
-callPanic(void)
-{
-       struct { const char *p; } a;
-       a.p = "panic from C";
-       crosscall2(_cgo_panic, &a, sizeof a);
-       *(int*)1 = 1;
-}
diff --git a/misc/cgo/test/callback_c_gc.c b/misc/cgo/test/callback_c_gc.c
new file mode 100644 (file)
index 0000000..8953b74
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2013 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 gc
+
+#include "_cgo_export.h"
+
+/* Test calling panic from C.  This is what SWIG does.  */
+
+extern void crosscall2(void (*fn)(void *, int), void *, int);
+extern void _cgo_panic(void *, int);
+
+void
+callPanic(void)
+{
+       struct { const char *p; } a;
+       a.p = "panic from C";
+       crosscall2(_cgo_panic, &a, sizeof a);
+       *(int*)1 = 1;
+}
diff --git a/misc/cgo/test/callback_c_gccgo.c b/misc/cgo/test/callback_c_gccgo.c
new file mode 100644 (file)
index 0000000..0ea7296
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2013 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
+
+#include "_cgo_export.h"
+
+/* Test calling panic from C.  This is what SWIG does.  */
+
+extern void _cgo_panic(const char *);
+
+void
+callPanic(void)
+{
+       _cgo_panic("panic from C");
+}