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:
11
src/do.c
11
src/do.c
@@ -292,14 +292,17 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
|
||||
res = TRUE;
|
||||
}
|
||||
} else if (obj->globby) {
|
||||
struct obj *globbyobj = obj; /* allow obj to be nonnull arg */
|
||||
|
||||
/* Globby things like puddings might stick together */
|
||||
while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) {
|
||||
pudding_merge_message(obj, otmp);
|
||||
while (globbyobj
|
||||
&& (otmp = obj_nexto_xy(globbyobj, x, y, TRUE)) != 0) {
|
||||
pudding_merge_message(globbyobj, otmp);
|
||||
/* intentionally not getting the melded object; obj_meld may set
|
||||
* obj to null. */
|
||||
(void) obj_meld(&obj, &otmp);
|
||||
(void) obj_meld(&globbyobj, &otmp);
|
||||
}
|
||||
res = (boolean) !obj;
|
||||
res = (boolean) !globbyobj;
|
||||
} else if (gc.context.mon_moving && IS_ALTAR(levl[x][y].typ)
|
||||
&& cansee(x,y)) {
|
||||
doaltarobj(obj);
|
||||
|
||||
Reference in New Issue
Block a user