!DEBUG warnings
With DEBUG suppressed, I started getting
16 warning: empty body in an if-statement
and 2 warning: empty body in an else-statement
from gcc.
Using braces for an empty block instead of just ';' avoids the warning:
if (foo)
debugpline("foo");
is bad,
if (bar) {
debugpline("bar");
}
is good. ;-)
The changes to lint.h are just precautionary.
modified:
include/lint.h
src/attrib.c, bones.c, dbridge.c, dig.c, eat.c,
makemon.c, mkmaze.c, mon.c, sp_lev.c
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 lint.h $NHDT-Date: 1430897871 2015/05/06 07:37:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
|
||||
/* NetHack 3.6 lint.h $NHDT-Date: 1449269910 2015/12/04 22:58:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
/*
|
||||
@@ -36,19 +36,21 @@ extern unsigned nhUse_dummy;
|
||||
#ifdef DEBUG
|
||||
#define showdebug(file) debugcore(file, TRUE)
|
||||
#define explicitdebug(file) debugcore(file, FALSE)
|
||||
#define ifdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) \
|
||||
stmt; \
|
||||
#define ifdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) { \
|
||||
stmt; \
|
||||
} \
|
||||
} while (0)
|
||||
#ifdef _MSC_VER
|
||||
/* if we have microsoft's C runtime we can use these instead */
|
||||
#include <crtdbg.h>
|
||||
#define crtdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) \
|
||||
stmt; \
|
||||
_RPT0(_CRT_WARN, "\n"); \
|
||||
#define crtdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) { \
|
||||
stmt; \
|
||||
} \
|
||||
_RPT0(_CRT_WARN, "\n"); \
|
||||
} while (0)
|
||||
#define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))
|
||||
#define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))
|
||||
|
||||
Reference in New Issue
Block a user