src/cmd/cgo/internal/test/callback_c_gccgo.c
raw| 1 | // Copyright 2013 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build gccgo |
| 6 | |
| 7 | #include "_cgo_export.h" |
| 8 | #include <stdint.h> |
| 9 | #include <stdio.h> |
| 10 | #include <stdlib.h> |
| 11 | |
| 12 | /* Test calling panic from C. This is what SWIG does. */ |
| 13 | |
| 14 | extern void _cgo_panic(const char *); |
| 15 | extern void *_cgo_allocate(size_t); |
| 16 | |
| 17 | void |
| 18 | callPanic(void) |
| 19 | { |
| 20 | _cgo_panic("panic from C"); |
| 21 | } |