1 /* NetHack 3.6 lint.h $NHDT-Date: 1454571508 2016/02/04 07:38:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.4 $ */
2 /* NetHack may be freely redistributed. See license for details. */
5 * Hacks to suppress compiler warnings. Use with caution.
6 * Assumes it has been preceded by '#include "config.h"' but
7 * not necessarily by '#include "hack.h"'.
12 /* cast away implicit const from a string literal (caller's responsibility
13 to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings'
14 (also caller's responsibility to ensure it isn't actually modified!) */
15 #define nhStr(str) ((char *) str)
17 #if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE)
18 #define FORCE_ARG_USAGE
21 #ifdef FORCE_ARG_USAGE
22 /* force an unused function argument to become used in an arbitrary
23 manner in order to suppress warning about unused function arguments;
24 viable for scalar and pointer arguments */
25 #define nhUse(arg) nhUse_dummy += (unsigned) !(arg)
26 extern unsigned nhUse_dummy
;
28 #define nhUse(arg) /*empty*/
32 * This stuff isn't related to lint suppression but lives here to
33 * avoid cluttering up hack.h.
35 /* [DEBUG shouldn't be defined unless you know what you're doing...] */
37 #define showdebug(file) debugcore(file, TRUE)
38 #define explicitdebug(file) debugcore(file, FALSE)
39 #define ifdebug(stmt) \
41 if (showdebug(__FILE__)) { \
46 /* if we have microsoft's C runtime we can use these instead */
48 #define crtdebug(stmt) \
50 if (showdebug(__FILE__)) { \
53 _RPT0(_CRT_WARN, "\n"); \
55 #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))
56 #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))
57 #define debugpline2(fmt, a1, a2) crtdebug(_RPT2(_CRT_WARN, fmt, a1, a2))
58 #define debugpline3(fmt, a1, a2, a3) \
59 crtdebug(_RPT3(_CRT_WARN, fmt, a1, a2, a3))
60 #define debugpline4(fmt, a1, a2, a3, a4) \
61 crtdebug(_RPT4(_CRT_WARN, fmt, a1, a2, a3, a4))
63 /* these don't require compiler support for C99 variadic macros */
64 #define debugpline0(str) ifdebug(pline(str))
65 #define debugpline1(fmt, arg) ifdebug(pline(fmt, arg))
66 #define debugpline2(fmt, a1, a2) ifdebug(pline(fmt, a1, a2))
67 #define debugpline3(fmt, a1, a2, a3) ifdebug(pline(fmt, a1, a2, a3))
68 #define debugpline4(fmt, a1, a2, a3, a4) ifdebug(pline(fmt, a1, a2, a3, a4))
71 #define debugpline0(str) /*empty*/
72 #define debugpline1(fmt, arg) /*empty*/
73 #define debugpline2(fmt, a1, a2) /*empty*/
74 #define debugpline3(fmt, a1, a2, a3) /*empty*/
75 #define debugpline4(fmt, a1, a2, a3, a4) /*empty*/