diff --git a/include/lint.h b/include/lint.h index d812117fb..76d9aee7a 100644 --- a/include/lint.h +++ b/include/lint.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 lint.h $NHDT-Date: 1596498539 2020/08/03 23:48:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */ +/* NetHack 3.7 lint.h $NHDT-Date: 1655631029 2022/06/19 09:30:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ */ /* Copyright (c) 2016 by Robert Patrick Rankin */ /* NetHack may be freely redistributed. See license for details. */ @@ -15,7 +15,7 @@ (also caller's responsibility to ensure it isn't actually modified!) */ #define nhStr(str) ((char *) str) -#define nhUse(arg) (void)(arg) +#define nhUse(arg) ((void) (arg)) /* * This stuff isn't related to lint suppression but lives here to @@ -25,21 +25,28 @@ #ifdef DEBUG #define showdebug(file) debugcore(file, TRUE) #define explicitdebug(file) debugcore(file, FALSE) -#define ifdebug(stmt) \ - do { \ - if (showdebug(__FILE__)) { \ - stmt; \ - } \ + /* in case 'stmt' is pline() or something which calls pline(), + save and restore previous plnmsg code so that use of debugpline() + doesn't change message semantics */ +#define ifdebug(stmt) \ + do { \ + if (showdebug(__FILE__)) { \ + int save_plnmsg = iflags.last_msg; \ + stmt; \ + iflags.last_msg = save_plnmsg; \ + } \ } while (0) #ifdef _MSC_VER /* if we have microsoft's C runtime we can use these instead */ #include -#define crtdebug(stmt) \ - do { \ - if (showdebug(__FILE__)) { \ - stmt; \ - } \ - _RPT0(_CRT_WARN, "\n"); \ +#define crtdebug(stmt) \ + do { \ + if (showdebug(__FILE__)) { \ + int save_plnmsg = iflags.last_msg; \ + stmt; \ + iflags.last_msg = save_plnmsg; \ + } \ + _RPT0(_CRT_WARN, "\n"); \ } while (0) #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str)) #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))