expand support for noreturn declarations
Although gcc specifies support for declaring a function as noreturn after the function name and parameters, other compilers do so via an attribute at the start of the declaration. Add some macro support for the attribute-at-the-beginning method: o MS Visual Studio compiler o Upcoming C23 standard (untested at this point)
This commit is contained in:
@@ -765,6 +765,8 @@ same_race(struct permonst* pm1, struct permonst* pm2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DISABLE_WARNING_UNREACHABLE_CODE
|
||||
|
||||
/* return an index into the mons array */
|
||||
int
|
||||
monsndx(struct permonst* ptr)
|
||||
@@ -775,11 +777,14 @@ monsndx(struct permonst* ptr)
|
||||
if (i < LOW_PM || i >= NUMMONS) {
|
||||
panic("monsndx - could not index monster (%s)",
|
||||
fmt_ptr((genericptr_t) ptr));
|
||||
/*NOTREACHED*/
|
||||
return NON_PM; /* will not get here */
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
RESTORE_WARNING_UNREACHABLE_CODE
|
||||
|
||||
/* for handling alternate spellings */
|
||||
struct alt_spl {
|
||||
const char *name;
|
||||
|
||||
Reference in New Issue
Block a user