From: nhmall Date: Mon, 18 Jan 2021 03:58:52 +0000 (-0500) Subject: some Microsoft compiler warnings X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb43299451fa0350c157f04ed1f2544e02adbde0;p=nethack some Microsoft compiler warnings src/muse.c(2255) : warning C4702: unreachable code src/options.c(2549) : warning C4702: unreachable code src/restore.c(930) : warning C4701: potentially uninitialized local variable 'stway' used src/sp_lev.c(5118) : warning C4701: potentially uninitialized local variable 'x' used src/sp_lev.c(5118) : warning C4701: potentially uninitialized local variable 'y' used src/trap.c(2979) : warning C4701: potentially uninitialized local variable 'cc' used src/trap.c(2985) : warning C4701: potentially uninitialized local variable 'bcc' used --- diff --git a/src/muse.c b/src/muse.c index 91aaa9c8e..b1e35cc1e 100644 --- a/src/muse.c +++ b/src/muse.c @@ -2252,6 +2252,7 @@ struct monst *mtmp; } return 1; } + /*NOTREACHED*/ return 0; case 0: return 0; /* i.e. an exploded wand */ diff --git a/src/options.c b/src/options.c index e8dd2412a..75c5baab4 100644 --- a/src/options.c +++ b/src/options.c @@ -2544,7 +2544,6 @@ char *op; flags.paranoia_bits &= ~PARANOID_PRAY; else flags.paranoia_bits |= PARANOID_PRAY; - return optn_ok; } return optn_ok; } diff --git a/src/restore.c b/src/restore.c index 32657d5a9..0b771ad28 100644 --- a/src/restore.c +++ b/src/restore.c @@ -910,7 +910,7 @@ rest_stairs(nhfp) NHFILE *nhfp; { int buflen = 0; - stairway stway; + stairway stway = UNDEFINED_VALUES; int len = 0; stairway_free_all(); diff --git a/src/sp_lev.c b/src/sp_lev.c index dcf6ff645..bb405cabe 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -5069,7 +5069,7 @@ lspo_terrain(L) lua_State *L; { terrain tmpterrain; - xchar x, y; + xchar x = 0, y = 0; struct selectionvar *sel = NULL; int argc = lua_gettop(L); diff --git a/src/trap.c b/src/trap.c index 6cfd0e61d..1dd598051 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2931,8 +2931,8 @@ long ocount; register int tmp; schar dx, dy; int distance; - coord cc; - coord bcc; + coord cc = UNDEFINED_VALUES, + bcc = UNDEFINED_VALUES; int trycount = 0; boolean success = FALSE; int mindist = 4;