From: PatR Date: Fri, 18 Dec 2015 15:18:58 +0000 (-0800) Subject: warning bit X-Git-Tag: NetHack-3.6.1_RC01~1152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c097814f3c662ff9fe16c56b05f5f5bbbadeb00e;p=nethack warning bit Suppress a couple of 'dead increment' diagnostics from the clang static analyzer. The assignments are dead, but keeping the variable up to date is more valuable (in case someone someday changes the code to use the affected variable somewhere farther along in that function) than changing the code to avoid the assignments in order to prevent the diagnostic. This will only work to suppress the analyzer's diagnostic messages if either FORCE_ARG_USAGE or GCC_WARN is defined when compiling makemon.c. --- diff --git a/src/makemon.c b/src/makemon.c index 102379e4a..55cf66fab 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makemon.c $NHDT-Date: 1449269917 2015/12/04 22:58:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.105 $ */ +/* NetHack 3.6 makemon.c $NHDT-Date: 1450451931 2015/12/18 15:18:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.106 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -599,6 +599,8 @@ register struct monst *mtmp; else if (mac < 10 && rn2(2)) mac += 1 + mongets(mtmp, LEATHER_CLOAK); + nhUse(mac); /* suppress 'dead increment' from static analyzer */ + if (ptr != &mons[PM_GUARD] && ptr != &mons[PM_WATCHMAN] && ptr != &mons[PM_WATCH_CAPTAIN]) { if (!rn2(3))