From: cohrs Date: Tue, 25 Apr 2006 04:08:22 +0000 (+0000) Subject: gcc compilation warning bits X-Git-Tag: MOVE2GIT~1046 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c654fef3ff2acbacc835761eb2dba54c91f3f0b0;p=nethack gcc compilation warning bits some rather complex boolean operations needed more parentheses to avoid warnings. I think I put them in the right places. A couple other items: naked assignments in if stmts, and an extra function decl --- diff --git a/src/dungeon.c b/src/dungeon.c index f17d1d58b..869017d99 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -62,7 +62,6 @@ STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, struct lch #ifdef DUNGEON_OVERVIEW mapseen *mapseenchn = (struct mapseen *)0; -STATIC_DCL void FDECL(free_mapseen, (mapseen *)); STATIC_DCL mapseen *FDECL(load_mapseen, (int)); STATIC_DCL void FDECL(save_mapseen, (int, mapseen *)); STATIC_DCL mapseen *FDECL(find_mapseen, (d_level *)); @@ -1841,7 +1840,7 @@ recbranch_mapseen(source, dest) /* branch not found, so not a real branch. */ if (!br) return; - if (mptr = find_mapseen(source)) { + if ((mptr = find_mapseen(source)) != 0) { if (mptr->br && br != mptr->br) impossible("Two branches on the same level?"); mptr->br = br; @@ -2038,13 +2037,13 @@ d_level *lev; } #define INTEREST(feat) \ - ((feat).nfount) || \ - ((feat).nsink) || \ - ((feat).nthrone) || \ - ((feat).naltar) || \ - ((feat).nshop) || \ - ((feat).ntemple) || \ - ((feat).ntree) + ((feat).nfount || \ + (feat).nsink || \ + (feat).nthrone || \ + (feat).naltar || \ + (feat).nshop || \ + (feat).ntemple || \ + (feat).ntree) /* || ((feat).water) || \ ((feat).ice) || \ @@ -2056,11 +2055,12 @@ STATIC_OVL boolean interest_mapseen(mptr) mapseen *mptr; { - return (on_level(&u.uz, &mptr->lev) || (!mptr->feat.forgot) && ( + return on_level(&u.uz, &mptr->lev) || + (!mptr->feat.forgot && ( INTEREST(mptr->feat) || (mptr->custom) || (mptr->br) - )); + )); } /* recalculate mapseen for the current level */ @@ -2347,7 +2347,7 @@ boolean printdun; /* wizmode prints out proto dungeon names for clarity */ if (wizard) { s_level *slev; - if (slev = Is_special(&mptr->lev)) + if ((slev = Is_special(&mptr->lev)) != 0) Sprintf(eos(buf), " [%s]", slev->proto); } #endif diff --git a/src/muse.c b/src/muse.c index a69171541..f1b977ccf 100644 --- a/src/muse.c +++ b/src/muse.c @@ -2129,9 +2129,9 @@ boolean by_you; /* monsters can also use potions of acid */ if (obj->otyp == POT_ACID || ((obj->otyp == CORPSE || (obj->otyp == TIN && tinok)) && - obj->corpsenm == PM_LIZARD || - (acidic(&mons[obj->corpsenm]) && - obj->corpsenm != PM_GREEN_SLIME))) { + (obj->corpsenm == PM_LIZARD || + (acidic(&mons[obj->corpsenm]) && + obj->corpsenm != PM_GREEN_SLIME)))) { mon_consume_unstone(mon, obj, by_you, TRUE); return TRUE; } diff --git a/src/music.c b/src/music.c index 8939184c0..8ce9a7dbb 100644 --- a/src/music.c +++ b/src/music.c @@ -370,9 +370,9 @@ do_pit: chasm = maketrap(x,y,PIT); exercise(A_DEX, TRUE); else selftouch((Upolyd && - slithy(youmonst.data) || - nolimbs(youmonst.data)) ? - "Shaken, you" : "Falling down, you"); + (slithy(youmonst.data) || + nolimbs(youmonst.data))) ? + "Shaken, you" : "Falling down, you"); } } else newsym(x,y); break;