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.
This commit is contained in:
PatR
2015-12-18 07:18:58 -08:00
parent fcc30bee88
commit c097814f3c

View File

@@ -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))