diff --git a/include/hack.h b/include/hack.h index 2dcc91699..ac4703f2b 100644 --- a/include/hack.h +++ b/include/hack.h @@ -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 diff --git a/include/lint.h b/include/lint.h new file mode 100644 index 000000000..abe98888c --- /dev/null +++ b/include/lint.h @@ -0,0 +1,52 @@ +/* NetHack 3.5 lint.h $NHDT-Date: 1430897871 2015/05/06 07:37:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */ +/* NetHack may be freely redistributed. See license for details. */ + +/* + * Hacks to suppress compiler warnings. Use with caution. + * Assumes it has been preceded by '#include "config.h"' but + * not necessarily by '#include "hack.h"'. + */ +#ifndef LINT_H +#define LINT_H + +/* cast away implicit const from a string literal (caller's responsibility + to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings' + (also caller's responsibility to ensure it isn't actually modified!) */ +#define nhStr(str) ((char *)str) + +#if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE) +# define FORCE_ARG_USAGE +#endif + +#ifdef FORCE_ARG_USAGE +/* force an unused function argument to become used in an arbitrary + manner in order to suppress warning about unused function arguments; + viable for scalar and pointer arguments */ +# define nhUse(arg) nhUse_dummy += (unsigned)arg; +extern unsigned nhUse_dummy; +#else +# define nhUse(arg) /*empty*/ +#endif + +/* + * This stuff isn't related to lint suppression but lives here to + * avoid cluttering up hack.h. + */ +/* [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*/ + +#endif /* LINT_H */ diff --git a/src/decl.c b/src/decl.c index 3508b2621..3bbced5cc 100644 --- a/src/decl.c +++ b/src/decl.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 decl.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 decl.c $NHDT-Date: 1430897862 2015/05/06 07:37:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.56 $ */ /* NetHack 3.5 decl.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.37 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -331,6 +331,9 @@ NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = { char *ARGV0; #endif +/* support for lint.h */ +unsigned nhUse_dummy = 0; + /* dummy routine used to force linkage */ void decl_init() diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 79d34fc64..be4c00d7c 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.5 Makefile.src $NHDT-Date: 1428590253 2015/04/09 14:37:33 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.38 $ +# NetHack 3.5 Makefile.src $NHDT-Date: 1430897864 2015/05/06 07:37:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ # NetHack 3.5 Makefile.src $Date: 2012/01/20 03:41:33 $ $Revision: 1.37 $ # Root of source tree: @@ -369,7 +369,8 @@ CSOURCES = $(HACKCSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC) HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ color.h config.h config1.h context.h coord.h decl.h def_os2.h \ display.h dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h \ - global.h hack.h lev.h macconf.h mextra.h mfndpos.h micro.h mkroom.h \ + global.h hack.h lev.h lint.h macconf.h mextra.h mfndpos.h micro.h \ + mkroom.h \ monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \ os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h rm.h \ sp_lev.h spell.h sys.h system.h tcap.h timeout.h tosconf.h tradstdc.h \ @@ -572,7 +573,7 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/wceconf.h ../include/ntconf.h touch $(CONFIG_H) # hack.h timestamp -$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/align.h \ +$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ ../include/dungeon.h ../include/monsym.h ../include/mkroom.h \ ../include/objclass.h ../include/youprop.h ../include/prop.h \ ../include/permonst.h ../include/monattk.h \ @@ -624,7 +625,7 @@ topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h ../include/tcap.h $(CC) $(CFLAGS) -c ../win/tty/wintty.c Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \ - $(CONFIG_H) + $(CONFIG_H) ../include/lint.h $(CC) $(CFLAGS) -c ../win/X11/Window.c dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) $(CC) $(CFLAGS) -c ../win/X11/dialogs.c