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,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1447653422 2015/11/16 05:57:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.517 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1448210010 2015/11/22 16:33:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.519 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -636,12 +636,12 @@ E void FDECL(done_intr, (int));
|
||||
#endif
|
||||
E void FDECL(done_in_by, (struct monst *, int));
|
||||
#endif /* !MAKEDEFS_C && !LEV_LEX_C */
|
||||
E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2);
|
||||
E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2) NORETURN;
|
||||
#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C)
|
||||
E void FDECL(done, (int));
|
||||
E void FDECL(container_contents,
|
||||
(struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P));
|
||||
E void FDECL(terminate, (int));
|
||||
E void FDECL(container_contents, (struct obj *, BOOLEAN_P,
|
||||
BOOLEAN_P, BOOLEAN_P));
|
||||
E void FDECL(terminate, (int)) NORETURN;
|
||||
E int NDECL(dovanquished);
|
||||
E int NDECL(num_genocides);
|
||||
E void FDECL(delayed_killer, (int, int, const char *));
|
||||
@@ -2526,8 +2526,8 @@ E boolean NDECL(authorize_wizard_mode);
|
||||
|
||||
/* ### vmsmisc.c ### */
|
||||
|
||||
E void NDECL(vms_abort);
|
||||
E void FDECL(vms_exit, (int));
|
||||
E void NDECL(vms_abort) NORETURN;
|
||||
E void FDECL(vms_exit, (int)) NORETURN;
|
||||
#ifdef PANICTRACE
|
||||
E void FDECL(vms_traceback, (int));
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1447755973 2015/11/17 10:26:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
|
||||
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1448210011 2015/11/22 16:33:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -385,6 +385,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
||||
#endif
|
||||
#if __GNUC__ >= 3
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -394,5 +395,8 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
||||
#ifndef UNUSED
|
||||
#define UNUSED
|
||||
#endif
|
||||
#ifndef NORETURN
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
#endif /* TRADSTDC_H */
|
||||
|
||||
Reference in New Issue
Block a user