new file: include/lint.h

modified files: include/hack.h, src/decl.c, sys/unix/Makefile.src

Groundwork for cleaning up the X11 sources, where gcc with the option
settings specified in the OSX hints file currently generates close to
400 warnings for win/X11/*.c.

lint.h is included by hack.h, and I've moved the debugpline stuff from
the latter to the former to hide it better.  (By rights it belongs in
debug.h or something of the sort, but I didn't want to go that far.)
Makefile and project dependencies need to catch up.

nhStr() hides a cast to char *, and is intended to by used on string
literals where it isn't feasible to maintain the 'const' attribute.
(A pernicious problem with X11 code, where the include situation can
become very convoluted, and many, MANY string literals are hidden
behind macros to look like keyword-type tokens.)

nhUse() can be used to force a fake usage on something which triggers
an unused parameter warning.  There are a 6 or 8 or 10 places in the
core code where that applies, but so far I have't touched any of them.
There's a tradeoff since it will result in some worthless code being
generated and executed, but is much simpler than tacking on compiler-
specific workarounds like '#pragma unused' or gcc's __attribute__ hack.
This commit is contained in:
PatR
2015-05-06 00:38:16 -07:00
parent 2a4bf5efa7
commit e72246f1d1
4 changed files with 63 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 hack.h $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.52 $ */
/* NetHack 3.5 hack.h $NHDT-Date: 1430897858 2015/05/06 07:37:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* NetHack 3.5 hack.h $Date: 2009/05/06 10:44:46 $ $Revision: 1.49 $ */
/* SCCS Id: @(#)hack.h 3.5 2008/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -10,23 +10,7 @@
#ifndef CONFIG_H
#include "config.h"
#endif
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
#ifdef DEBUG
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
/* these don't require compiler support for C99 variadic macros */
# define debugpline0(str) ifdebug(pline(str))
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
#else
# define debugpline0(str) /*empty*/
# define debugpline1(fmt,arg) /*empty*/
# define debugpline2(fmt,a1,a2) /*empty*/
# define debugpline3(fmt,a1,a2,a3) /*empty*/
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
#endif /*DEBUG*/
#include "lint.h"
#define TELL 1
#define NOTELL 0