1 /* go-panic.h -- declare the go panic functions.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #ifndef LIBGO_GO_PANIC_H
8 #define LIBGO_GO_PANIC_H
10 #include "interface.h"
13 struct __go_type_descriptor;
14 struct __go_defer_stack;
16 /* The stack of panic calls. */
18 struct __go_panic_stack
20 /* The next entry in the stack. */
21 struct __go_panic_stack *__next;
23 /* The value associated with this panic. */
24 struct __go_empty_interface __arg;
26 /* Whether this panic has been recovered. */
27 _Bool __was_recovered;
29 /* Whether this panic was pushed on the stack because of an
30 exception thrown in some other language. */
34 /* The panic and defer stacks, grouped together into a single thread
35 local variable for convenience for systems without TLS. */
37 struct __go_panic_defer_struct
39 /* The list of defers to execute. */
40 struct __go_defer_stack *__defer;
42 /* The list of currently active panics. There will be more than one
43 if a deferred function calls panic. */
44 struct __go_panic_stack *__panic;
46 /* The current exception being thrown when unwinding after a call to
47 panic . This is really struct _UnwindException *. */
50 /* Whether the current exception is from some other language. */
58 extern __thread struct __go_panic_defer_struct *__go_panic_defer;
64 extern void __go_panic (struct __go_empty_interface)
65 __attribute__ ((noreturn));
67 extern void __go_panic_msg (const char* msg)
68 __attribute__ ((noreturn));
70 extern void __go_print_string (struct __go_string);
72 extern struct __go_empty_interface __go_recover (void);
74 extern void __go_unwind_stack (void);
76 /* Functions defined in libgo/go/runtime/error.go. */
78 extern void newTypeAssertionError(const struct __go_type_descriptor *pt1,
79 const struct __go_type_descriptor *pt2,
80 const struct __go_type_descriptor *pt3,
81 const struct __go_string *ps1,
82 const struct __go_string *ps2,
83 const struct __go_string *ps3,
84 const struct __go_string *pmeth,
85 struct __go_empty_interface *ret)
86 __asm__ ("libgo_runtime.runtime.NewTypeAssertionError");
88 extern void newErrorString(struct __go_string, struct __go_empty_interface *)
89 __asm__ ("libgo_runtime.runtime.NewErrorString");
91 extern void printany(struct __go_empty_interface)
92 __asm__ ("libgo_runtime.runtime.Printany");
94 #endif /* !defined(LIBGO_GO_PANIC_H) */