flag panic() and terminate() as "no return"
Mark panic() as never returning so that code analysis might be able to do a smarter job. It required splitting done() into two routines since the first part really can return (but not if PANICKED was the reason it got called). done() is now much shorter and ends with a call to new really_done(), and panic() skips done()'s might-return part by calling really_done() directly. Noticed in passing: the "report error to <list of SYSCF WIZARDS>" code calls a routine which uses alloc(), which won't work very well if the reason for panic was because malloc() ran out of memory.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/* NetHack 3.6 panic.c $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 panic.c $NHDT-Date: 1448210012 2015/11/22 16:33:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
/*
|
||||
* This code was adapted from the code in end.c to run in a standalone
|
||||
* mode for the makedefs / drg code.
|
||||
* This code was adapted from the code in end.c to run in a standalone
|
||||
* mode for the makedefs / drg code.
|
||||
*/
|
||||
|
||||
#define NEED_VARARGS
|
||||
@@ -43,7 +43,6 @@ VA_DECL(char *, str)
|
||||
#endif
|
||||
VA_END();
|
||||
exit(EXIT_FAILURE); /* redundant */
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ALLOCA_HACK
|
||||
|
||||
Reference in New Issue
Block a user