From ec5d7ba95c4ae49517f832644979ecbefdf657cc Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Fri, 18 Jul 2014 16:30:38 +1000 Subject: runtime: add throwgo Fixes #8380. Also update hashmap.go to use throwgo rather than panic. LGTM=khr R=khr, rsc CC=golang-codereviews https://golang.org/cl/115860045 --- src/pkg/runtime/panic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/pkg/runtime/panic.c') diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index 8225df7db7..ce05725037 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -524,6 +524,18 @@ runtime·throw(int8 *s) runtime·exit(1); // even more not reached } +void +runtime·throwgo(String s) +{ + if(g->m->throwing == 0) + g->m->throwing = 1; + runtime·startpanic(); + runtime·printf("fatal error: %S\n", s); + runtime·dopanic(0); + *(int32*)0 = 0; // not reached + runtime·exit(1); // even more not reached +} + void runtime·panicstring(int8 *s) { -- cgit v1.3