part2: remediate some nonnull-related compiler warnings
do.c:296:16: warning: nonnull parameter 'obj' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
296 | while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) {
| ^~~ ~~
../include/extern.h:538:43: note: declared 'nonnull' here
538 | const char *) NONNULLPTRS;
| ^
../include/tradstdc.h:378:36: note: expanded from macro 'NONNULLPTRS'
378 | #define NONNULLPTRS __attribute__((nonnull))
| ^
1 warning generated.
invent.c:807:12: warning: nonnull parameter 'objlist' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
807 | while (objlist) {
| ~~~~~ ^~~~~~~
../include/extern.h:1230:61: note: declared 'nonnull' here
1230 | extern struct obj *merge_choice(struct obj *, struct obj *) NONNULLPTRS;
| ^
../include/tradstdc.h:378:36: note: expanded from macro 'NONNULLPTRS'
378 | #define NONNULLPTRS __attribute__((nonnull))
| ^
1 warning generated.
monmove.c:2091:23: warning: nonnull parameter 'mtmp' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
2091 | boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion);
| ^~~~ ~~
../include/extern.h:1844:67: note: declared 'nonnull' here
1844 | extern boolean undesirable_disp(struct monst *, coordxy, coordxy) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
1 warning generated.
nhlua.c:2095:9: warning: nonnull parameter 'L' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
2095 | if (L)
| ~~ ^
../include/extern.h:1985:35: note: declared 'nonnull' here
1985 | extern void nhl_done(lua_State *) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
1 warning generated.
steal.c:59:12: warning: nonnull parameter 'chain' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
59 | while (chain && chain->otyp != GOLD_PIECE)
| ^~~~~ ~~
../include/extern.h:2910:43: note: declared 'nonnull' here
2910 | extern struct obj *findgold(struct obj *) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
1 warning generated.
utf8map.c:232:9: warning: nonnull parameter 'gmap' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
232 | if (gmap) {
| ~~ ^~~~
../include/extern.h:3318:28: note: declared 'nonnull' here
3318 | long ucolor) NONNULLPTRS;
| ^
../include/tradstdc.h:378:36: note: expanded from macro 'NONNULLPTRS'
378 | #define NONNULLPTRS __attribute__((nonnull))
| ^
1 warning generated.
worn.c:895:15: warning: nonnull parameter 'objchain' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
895 | if (on && objchain)
| ~~ ^~~~~~~~
../include/extern.h:3664:51: note: declared 'nonnull' here
3664 | extern void bypass_objlist(struct obj *, boolean) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
worn.c:897:12: warning: nonnull parameter 'objchain' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
897 | while (objchain) {
| ~~~~~ ^~~~~~~~
../include/extern.h:3664:51: note: declared 'nonnull' here
3664 | extern void bypass_objlist(struct obj *, boolean) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
worn.c:908:12: warning: nonnull parameter 'objchain' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
908 | while (objchain) {
| ~~~~~ ^~~~~~~~
../include/extern.h:3665:53: note: declared 'nonnull' here
3665 | extern struct obj *nxt_unbypassed_obj(struct obj *) NONNULLARG1;
| ^
../include/tradstdc.h:379:36: note: expanded from macro 'NONNULLARG1'
379 | #define NONNULLARG1 __attribute__((nonnull (1)))
| ^
3 warnings generated.
This commit is contained in:
@@ -2092,8 +2092,10 @@ RESTORE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
void
|
||||
nhl_done(lua_State *L)
|
||||
{
|
||||
if (L)
|
||||
lua_close(L);
|
||||
lua_State *L2 = L; /* allow arg to be declared nonnull */
|
||||
|
||||
if (L2)
|
||||
lua_close(L2);
|
||||
iflags.in_lua = FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user