USE_OLDARGS update (1 of 2)
Files modified:
include/tradstdc.h, sp_lev.h, system.h
util/lev_main.c
Silence a bunch of warnings generated by recent gcc which weren't there
with whatever version I had when 3.6.0 was being readied for release.
For lev_main, there were two basic types: not enough arguments in calls
to lc_pline, lc_warning, and lc_error (since we weren't passing dummy
arguments as is done for add_opvars), and conversion from 'int' or
narrower to 'char *' (from -Wint-to-pointer-cast, which either wasn't
there yet in the older gcc, or wasn't included in -Wall back then).
[Note that for any configuration decrepit enough to actually need
USE_OLDARGS, such conversions will either work fine or else nethack
simply won't be viable.]
src/pline.c generates a bunch of warnings (for USE_OLDARGS). The fix
for that will be (2 of 2).
To test, instead of mucking about with CFLAGS or sys/unix/hints, I've
been temporarily adding unconditional
|#undef USE_STDARG
|#undef USE_VARARGS
|#define USE_OLDARGS
to the end of config1.h and then doing my normal build--which is why
-Wall (or possibly -W) is drawing -Wint-to-pointer-cast warnings.
This commit is contained in:
+27
-37
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 sp_lev.h $NHDT-Date: 1470212260 2016/08/03 08:17:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $ */
|
/* NetHack 3.6 sp_lev.h $NHDT-Date: 1501723399 2017/08/03 01:23:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.20 $ */
|
||||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -484,61 +484,51 @@ struct lc_breakdef {
|
|||||||
#ifdef SPEC_LEV
|
#ifdef SPEC_LEV
|
||||||
/* compiling lev_comp rather than nethack */
|
/* compiling lev_comp rather than nethack */
|
||||||
#ifdef USE_OLDARGS
|
#ifdef USE_OLDARGS
|
||||||
#undef VA_ARGS
|
#ifndef VA_TYPE
|
||||||
#undef VA_DECL
|
typedef const char *vA;
|
||||||
#undef VA_DECL2
|
#define VA_TYPE
|
||||||
#undef VA_SHIFT
|
#endif
|
||||||
|
#undef VA_ARGS /* redefine with the maximum number actually used */
|
||||||
|
#undef VA_SHIFT /* ditto */
|
||||||
#define VA_ARGS \
|
#define VA_ARGS \
|
||||||
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, \
|
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, \
|
||||||
arg12, arg13, arg14
|
arg12, arg13, arg14
|
||||||
#define VA_DECL(typ1, var1) \
|
/* Unlike in the core, lev_comp's VA_SHIFT should be completely safe,
|
||||||
(var1, VA_ARGS) typ1 var1; \
|
because callers always pass all these arguments. */
|
||||||
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9, \
|
|
||||||
*arg10, *arg11, *arg12, *arg13, *arg14; \
|
|
||||||
{
|
|
||||||
#define VA_DECL2(typ1, var1, typ2, var2) \
|
|
||||||
(var1, var2, VA_ARGS) typ1 var1; \
|
|
||||||
typ2 var2; \
|
|
||||||
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9, \
|
|
||||||
*arg10, *arg11, *arg12, *arg13, *arg14; \
|
|
||||||
{
|
|
||||||
/* unlike in the core, lev_comp's VA_SHIFT is completely safe,
|
|
||||||
because callers always pass all these arguments */
|
|
||||||
#define VA_SHIFT() \
|
#define VA_SHIFT() \
|
||||||
(arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \
|
(arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \
|
||||||
arg6 = arg7, arg7 = arg8, arg8 = arg9, arg9 = arg10, arg10 = arg11, \
|
arg6 = arg7, arg7 = arg8, arg8 = arg9, arg9 = arg10, arg10 = arg11, \
|
||||||
arg11 = arg12, arg12 = arg13, arg13 = arg14, arg14 = 0)
|
arg11 = arg12, arg12 = arg13, arg13 = arg14, arg14 = 0)
|
||||||
/* standard NULL may be either (void *)0 or plain 0, both of
|
/* standard NULL may be either (void *)0 or plain 0, both of
|
||||||
which would need to be explicitly cast to (char *) here */
|
which would need to be explicitly cast to (char *) here */
|
||||||
typedef char *Va;
|
|
||||||
#define VA_PASS1(a1) \
|
#define VA_PASS1(a1) \
|
||||||
(Va) a1, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, \
|
(vA) a1, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS2(a1, a2) \
|
#define VA_PASS2(a1, a2) \
|
||||||
(Va) a1, (Va) a2, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, \
|
(vA) a1, (vA) a2, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS3(a1, a2, a3) \
|
#define VA_PASS3(a1, a2, a3) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS4(a1, a2, a3, a4) \
|
#define VA_PASS4(a1, a2, a3, a4) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) 0, (Va) 0, (Va) 0, (Va) 0, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) 0, (vA) 0, (vA) 0, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS5(a1, a2, a3, a4, a5) \
|
#define VA_PASS5(a1, a2, a3, a4, a5) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) a5, (Va) 0, (Va) 0, (Va) 0, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) a5, (vA) 0, (vA) 0, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS7(a1, a2, a3, a4, a5, a6, a7) \
|
#define VA_PASS7(a1, a2, a3, a4, a5, a6, a7) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) a5, (Va) a6, (Va) a7, (Va) 0, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) a5, (vA) a6, (vA) a7, (vA) 0, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
#define VA_PASS8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) a5, (Va) a6, (Va) a7, (Va) a8, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) a5, (vA) a6, (vA) a7, (vA) a8, \
|
||||||
(Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
#define VA_PASS9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) a5, (Va) a6, (Va) a7, (Va) a8, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) a5, (vA) a6, (vA) a7, (vA) a8, \
|
||||||
(Va) a9, (Va) 0, (Va) 0, (Va) 0, (Va) 0, (Va) 0
|
(vA) a9, (vA) 0, (vA) 0, (vA) 0, (vA) 0, (vA) 0
|
||||||
#define VA_PASS14(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, \
|
#define VA_PASS14(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, \
|
||||||
a14) \
|
a14) \
|
||||||
(Va) a1, (Va) a2, (Va) a3, (Va) a4, (Va) a5, (Va) a6, (Va) a7, (Va) a8, \
|
(vA) a1, (vA) a2, (vA) a3, (vA) a4, (vA) a5, (vA) a6, (vA) a7, (vA) a8, \
|
||||||
(Va) a9, (Va) a10, (Va) a11, (Va) a12, (Va) a13, (Va) a14
|
(vA) a9, (vA) a10, (vA) a11, (vA) a12, (vA) a13, (vA) a14
|
||||||
#else /*!USE_OLDARGS*/
|
#else /*!USE_OLDARGS*/
|
||||||
/* USE_STDARG and USE_VARARGS don't need to pass dummy arguments
|
/* USE_STDARG and USE_VARARGS don't need to pass dummy arguments
|
||||||
or cast real ones */
|
or cast real ones */
|
||||||
|
|||||||
+10
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 system.h $NHDT-Date: 1449269772 2015/12/04 22:56:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ */
|
/* NetHack 3.6 system.h $NHDT-Date: 1501723401 2017/08/03 01:23:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.13 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -489,8 +489,17 @@ E int FDECL(vprintf, (const char *, va_list));
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#ifdef vprintf
|
||||||
|
#undef vprintf
|
||||||
|
#endif
|
||||||
#define vprintf printf
|
#define vprintf printf
|
||||||
|
#ifdef vfprintf
|
||||||
|
#undef vfprintf
|
||||||
|
#endif
|
||||||
#define vfprintf fprintf
|
#define vfprintf fprintf
|
||||||
|
#ifdef vsprintf
|
||||||
|
#undef vsprintf
|
||||||
|
#endif
|
||||||
#define vsprintf sprintf
|
#define vsprintf sprintf
|
||||||
#endif
|
#endif
|
||||||
#endif /* NEED_VARARGS */
|
#endif /* NEED_VARARGS */
|
||||||
|
|||||||
+16
-8
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1448210011 2015/11/22 16:33:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
|
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1501723401 2017/08/03 01:23:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.28 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -128,15 +128,23 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
/*USE_OLDARGS*/
|
/*USE_OLDARGS*/
|
||||||
|
/*
|
||||||
|
* CAVEAT: passing double (including float promoted to double) will
|
||||||
|
* almost certainly break this, as would any integer type bigger than
|
||||||
|
* sizeof (char *).
|
||||||
|
* NetHack avoids floating point, and any configuration able to use
|
||||||
|
* 'long long int' or I64P32 or the like should be using USE_STDARG.
|
||||||
|
*/
|
||||||
|
#ifndef VA_TYPE
|
||||||
|
typedef const char *vA;
|
||||||
|
#define VA_TYPE
|
||||||
|
#endif
|
||||||
#define VA_ARGS arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
|
#define VA_ARGS arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
|
||||||
#define VA_DECL(typ1, var1) \
|
#define VA_DECL(typ1, var1) \
|
||||||
(var1, VA_ARGS) typ1 var1; \
|
(var1, VA_ARGS) typ1 var1; vA VA_ARGS; \
|
||||||
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9; \
|
|
||||||
{
|
{
|
||||||
#define VA_DECL2(typ1, var1, typ2, var2) \
|
#define VA_DECL2(typ1, var1, typ2, var2) \
|
||||||
(var1, var2, VA_ARGS) typ1 var1; \
|
(var1, var2, VA_ARGS) typ1 var1; typ2 var2; vA VA_ARGS; \
|
||||||
typ2 var2; \
|
|
||||||
char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8, *arg9; \
|
|
||||||
{
|
{
|
||||||
#define VA_START(x)
|
#define VA_START(x)
|
||||||
#define VA_INIT(var1, typ1)
|
#define VA_INIT(var1, typ1)
|
||||||
@@ -151,7 +159,7 @@
|
|||||||
*/
|
*/
|
||||||
#define VA_SHIFT() \
|
#define VA_SHIFT() \
|
||||||
(arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \
|
(arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \
|
||||||
arg6 = arg7, arg7 = arg8, arg8 = arg9)
|
arg6 = arg7, arg7 = arg8, arg8 = arg9, arg9 = 0)
|
||||||
#define VA_NEXT(var1, typ1) ((var1 = (typ1) arg1), VA_SHIFT(), var1)
|
#define VA_NEXT(var1, typ1) ((var1 = (typ1) arg1), VA_SHIFT(), var1)
|
||||||
#define VA_END() }
|
#define VA_END() }
|
||||||
#endif
|
#endif
|
||||||
@@ -380,7 +388,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
|||||||
* append this to a prototype declaration (see pline() in extern.h).
|
* append this to a prototype declaration (see pline() in extern.h).
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#if __GNUC__ >= 2
|
#if (__GNUC__ >= 2) && !defined(USE_OLDARGS)
|
||||||
#define PRINTF_F(f, v) __attribute__((format(printf, f, v)))
|
#define PRINTF_F(f, v) __attribute__((format(printf, f, v)))
|
||||||
#endif
|
#endif
|
||||||
#if __GNUC__ >= 3
|
#if __GNUC__ >= 3
|
||||||
|
|||||||
+47
-34
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 lev_main.c $NHDT-Date: 1501461281 2017/07/31 00:34:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.46 $ */
|
/* NetHack 3.6 lev_main.c $NHDT-Date: 1501723418 2017/08/03 01:23:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */
|
||||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ char **argv;
|
|||||||
}
|
}
|
||||||
fin = freopen(fname, "r", stdin);
|
fin = freopen(fname, "r", stdin);
|
||||||
if (!fin) {
|
if (!fin) {
|
||||||
lc_pline("Can't open \"%s\" for input.\n", fname);
|
lc_pline("Can't open \"%s\" for input.\n", VA_PASS1(fname));
|
||||||
perror(fname);
|
perror(fname);
|
||||||
errors_encountered = TRUE;
|
errors_encountered = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@@ -644,56 +644,56 @@ VA_DECL2(sp_lev *, sp, const char *, fmt)
|
|||||||
case 'i': /* integer */
|
case 'i': /* integer */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_int(ov, VA_NEXT(la, long) );
|
set_opvar_int(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'c': /* coordinate */
|
case 'c': /* coordinate */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_coord(ov, VA_NEXT(la, long) );
|
set_opvar_coord(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'r': /* region */
|
case 'r': /* region */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_region(ov, VA_NEXT(la, long) );
|
set_opvar_region(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'm': /* mapchar */
|
case 'm': /* mapchar */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_mapchar(ov, VA_NEXT(la, long) );
|
set_opvar_mapchar(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'M': /* monster */
|
case 'M': /* monster */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_monst(ov, VA_NEXT(la, long) );
|
set_opvar_monst(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'O': /* object */
|
case 'O': /* object */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_obj(ov, VA_NEXT(la, long) );
|
set_opvar_obj(ov, VA_NEXT(la, long));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 's': /* string */
|
case 's': /* string */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_str(ov, VA_NEXT(lp, const char *) );
|
set_opvar_str(ov, VA_NEXT(lp, const char *));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'v': /* variable */
|
case 'v': /* variable */
|
||||||
{
|
{
|
||||||
struct opvar *ov = New(struct opvar);
|
struct opvar *ov = New(struct opvar);
|
||||||
set_opvar_var(ov, VA_NEXT(lp, const char *) );
|
set_opvar_var(ov, VA_NEXT(lp, const char *));
|
||||||
add_opcode(sp, SPO_PUSH, ov);
|
add_opcode(sp, SPO_PUSH, ov);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -701,12 +701,13 @@ VA_DECL2(sp_lev *, sp, const char *, fmt)
|
|||||||
{
|
{
|
||||||
long i = VA_NEXT(la, int);
|
long i = VA_NEXT(la, int);
|
||||||
if (i < 0 || i >= MAX_SP_OPCODES)
|
if (i < 0 || i >= MAX_SP_OPCODES)
|
||||||
lc_pline("add_opvars: unknown opcode '%ld'.", i);
|
lc_pline("add_opvars: unknown opcode '%ld'.", VA_PASS1(i));
|
||||||
add_opcode(sp, i, NULL);
|
add_opcode(sp, i, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
lc_pline("add_opvars: illegal format character '%c'.", *p);
|
lc_pline("add_opvars: illegal format character '%ld'.",
|
||||||
|
VA_PASS1((long) *p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -774,7 +775,8 @@ char *name;
|
|||||||
struct lc_funcdefs *f = New(struct lc_funcdefs);
|
struct lc_funcdefs *f = New(struct lc_funcdefs);
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
lc_error("Could not alloc function definition for '%s'.", name);
|
lc_error("Could not alloc function definition for '%s'.",
|
||||||
|
VA_PASS1(name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
f->next = NULL;
|
f->next = NULL;
|
||||||
@@ -855,7 +857,8 @@ char *name;
|
|||||||
struct lc_vardefs *f = New(struct lc_vardefs);
|
struct lc_vardefs *f = New(struct lc_vardefs);
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
lc_error("Could not alloc variable definition for '%s'.", name);
|
lc_error("Could not alloc variable definition for '%s'.",
|
||||||
|
VA_PASS1(name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
f->next = NULL;
|
f->next = NULL;
|
||||||
@@ -874,7 +877,7 @@ struct lc_vardefs *fchain;
|
|||||||
|
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (be_verbose && (tmp->n_used == 0))
|
if (be_verbose && (tmp->n_used == 0))
|
||||||
lc_warning("Unused variable '%s'", tmp->name);
|
lc_warning("Unused variable '%s'", VA_PASS1(tmp->name));
|
||||||
nxt = tmp->next;
|
nxt = tmp->next;
|
||||||
Free(tmp->name);
|
Free(tmp->name);
|
||||||
Free(tmp);
|
Free(tmp);
|
||||||
@@ -913,7 +916,7 @@ long spovar;
|
|||||||
spovar &= ~SPOVAR_ARRAY;
|
spovar &= ~SPOVAR_ARRAY;
|
||||||
switch (spovar) {
|
switch (spovar) {
|
||||||
default:
|
default:
|
||||||
lc_error("spovar2str(%ld)", spovar);
|
lc_error("spovar2str(%ld)", VA_PASS1(spovar));
|
||||||
break;
|
break;
|
||||||
case SPOVAR_INT:
|
case SPOVAR_INT:
|
||||||
n = "integer";
|
n = "integer";
|
||||||
@@ -969,9 +972,11 @@ long vartype;
|
|||||||
if ((tmp = vardef_defined(vd, varname, 1)) != 0) {
|
if ((tmp = vardef_defined(vd, varname, 1)) != 0) {
|
||||||
if (tmp->var_type != vartype)
|
if (tmp->var_type != vartype)
|
||||||
lc_error("Trying to use variable '%s' as %s, when it is %s.",
|
lc_error("Trying to use variable '%s' as %s, when it is %s.",
|
||||||
varname, spovar2str(vartype), spovar2str(tmp->var_type));
|
VA_PASS3(varname,
|
||||||
|
spovar2str(vartype),
|
||||||
|
spovar2str(tmp->var_type)));
|
||||||
} else
|
} else
|
||||||
lc_error("Variable '%s' not defined.", varname);
|
lc_error("Variable '%s' not defined.", VA_PASS1(varname));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lc_vardefs *
|
struct lc_vardefs *
|
||||||
@@ -985,7 +990,9 @@ long vartype;
|
|||||||
if ((tmp = vardef_defined(vd, varname, 1)) != 0) {
|
if ((tmp = vardef_defined(vd, varname, 1)) != 0) {
|
||||||
if (tmp->var_type != vartype)
|
if (tmp->var_type != vartype)
|
||||||
lc_error("Trying to redefine variable '%s' as %s, when it is %s.",
|
lc_error("Trying to redefine variable '%s' as %s, when it is %s.",
|
||||||
varname, spovar2str(vartype), spovar2str(tmp->var_type));
|
VA_PASS3(varname,
|
||||||
|
spovar2str(vartype),
|
||||||
|
spovar2str(tmp->var_type)));
|
||||||
} else {
|
} else {
|
||||||
tmp = vardef_new(vartype, varname);
|
tmp = vardef_new(vartype, varname);
|
||||||
tmp->next = vd;
|
tmp->next = vd;
|
||||||
@@ -1012,7 +1019,8 @@ int opcode;
|
|||||||
case SPO_JGE:
|
case SPO_JGE:
|
||||||
return SPO_JL;
|
return SPO_JL;
|
||||||
default:
|
default:
|
||||||
lc_error("Cannot reverse comparison jmp opcode %d.", opcode);
|
lc_error("Cannot reverse comparison jmp opcode %ld.",
|
||||||
|
VA_PASS1((long) opcode));
|
||||||
return SPO_NULL;
|
return SPO_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1054,7 +1062,8 @@ struct opvar *ov;
|
|||||||
tmpov->vardata.str[len] = '\0';
|
tmpov->vardata.str[len] = '\0';
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
lc_error("Unknown opvar_clone value type (%d)!", ov->spovartyp);
|
lc_error("Unknown opvar_clone value type (%ld)!",
|
||||||
|
VA_PASS1((long) ov->spovartyp));
|
||||||
} /* default */
|
} /* default */
|
||||||
} /* switch */
|
} /* switch */
|
||||||
return tmpov;
|
return tmpov;
|
||||||
@@ -1083,9 +1092,10 @@ char *ldfname;
|
|||||||
struct lc_funcdefs *f;
|
struct lc_funcdefs *f;
|
||||||
|
|
||||||
if (index(ldfname, '.'))
|
if (index(ldfname, '.'))
|
||||||
lc_error("Invalid dot ('.') in level name '%s'.", ldfname);
|
lc_error("Invalid dot ('.') in level name '%s'.", VA_PASS1(ldfname));
|
||||||
if ((int) strlen(ldfname) > 14)
|
if ((int) strlen(ldfname) > 14)
|
||||||
lc_error("Level names limited to 14 characters ('%s').", ldfname);
|
lc_error("Level names limited to 14 characters ('%s').",
|
||||||
|
VA_PASS1(ldfname));
|
||||||
f = function_definitions;
|
f = function_definitions;
|
||||||
while (f) {
|
while (f) {
|
||||||
f->n_called = 0;
|
f->n_called = 0;
|
||||||
@@ -1173,8 +1183,8 @@ char c;
|
|||||||
if (!class || class == mons[i].mlet)
|
if (!class || class == mons[i].mlet)
|
||||||
if (!case_insensitive_comp(s, mons[i].mname)) {
|
if (!case_insensitive_comp(s, mons[i].mname)) {
|
||||||
if (be_verbose)
|
if (be_verbose)
|
||||||
lc_warning("Monster type \"%s\" matches \"%s\".", s,
|
lc_warning("Monster type \"%s\" matches \"%s\".",
|
||||||
mons[i].mname);
|
VA_PASS2(s, mons[i].mname));
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return ERR;
|
return ERR;
|
||||||
@@ -1209,7 +1219,8 @@ char c; /* class */
|
|||||||
objname = obj_descr[i].oc_name;
|
objname = obj_descr[i].oc_name;
|
||||||
if (objname && !case_insensitive_comp(s, objname)) {
|
if (objname && !case_insensitive_comp(s, objname)) {
|
||||||
if (be_verbose)
|
if (be_verbose)
|
||||||
lc_warning("Object type \"%s\" matches \"%s\".", s, objname);
|
lc_warning("Object type \"%s\" matches \"%s\".",
|
||||||
|
VA_PASS2(s, objname));
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1318,14 +1329,14 @@ genericptr_t dat;
|
|||||||
_opcode *tmp;
|
_opcode *tmp;
|
||||||
|
|
||||||
if ((opc < 0) || (opc >= MAX_SP_OPCODES))
|
if ((opc < 0) || (opc >= MAX_SP_OPCODES))
|
||||||
lc_error("Unknown opcode '%d'", opc);
|
lc_error("Unknown opcode '%ld'", VA_PASS1((long) opc));
|
||||||
|
|
||||||
tmp = (_opcode *) alloc(sizeof(_opcode) * (nop + 1));
|
tmp = (_opcode *) alloc(sizeof(_opcode) * (nop + 1));
|
||||||
if (!tmp) { /* lint suppression */
|
if (!tmp) { /* lint suppression */
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
#if 0
|
#if 0
|
||||||
/* not possible; alloc() never returns Null */
|
/* not possible; alloc() never returns Null */
|
||||||
lc_error("Could not alloc opcode space");
|
lc_error("%s", VA_PASS1("Could not alloc opcode space"));
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1396,9 +1407,9 @@ sp_lev *sp;
|
|||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
if ((tmpmap[max_hig][i] = what_map_char(map[i]))
|
if ((tmpmap[max_hig][i] = what_map_char(map[i]))
|
||||||
== INVALID_TYPE) {
|
== INVALID_TYPE) {
|
||||||
lc_warning("Invalid character '%c' @ (%d, %d) - replacing "
|
lc_warning(
|
||||||
"with stone",
|
"Invalid character '%ld' @ (%ld, %ld) - replacing with stone",
|
||||||
map[i], max_hig, i);
|
VA_PASS3((long) map[i], (long) max_hig, (long) i));
|
||||||
tmpmap[max_hig][i] = STONE;
|
tmpmap[max_hig][i] = STONE;
|
||||||
}
|
}
|
||||||
while (i < max_len)
|
while (i < max_len)
|
||||||
@@ -1413,8 +1424,9 @@ sp_lev *sp;
|
|||||||
max_y_map = max_hig - 1;
|
max_y_map = max_hig - 1;
|
||||||
|
|
||||||
if (max_len > MAP_X_LIM || max_hig > MAP_Y_LIM) {
|
if (max_len > MAP_X_LIM || max_hig > MAP_Y_LIM) {
|
||||||
lc_error("Map too large at (%d x %d), max is (%d x %d)", max_len,
|
lc_error("Map too large at (%ld x %ld), max is (%ld x %ld)",
|
||||||
max_hig, MAP_X_LIM, MAP_Y_LIM);
|
VA_PASS4((long) max_len, (long) max_hig,
|
||||||
|
(long) MAP_X_LIM, (long) MAP_Y_LIM));
|
||||||
}
|
}
|
||||||
|
|
||||||
mbuf = (char *) alloc(((max_hig - 1) * max_len) + (max_len - 1) + 2);
|
mbuf = (char *) alloc(((max_hig - 1) * max_len) + (max_len - 1) + 2);
|
||||||
@@ -1424,7 +1436,8 @@ sp_lev *sp;
|
|||||||
|
|
||||||
mbuf[((max_hig - 1) * max_len) + (max_len - 1) + 1] = '\0';
|
mbuf[((max_hig - 1) * max_len) + (max_len - 1) + 1] = '\0';
|
||||||
|
|
||||||
add_opvars(sp, "siio", VA_PASS4(mbuf, max_hig, max_len, SPO_MAP));
|
add_opvars(sp, "siio", VA_PASS4(mbuf, (long) max_hig, (long) max_len,
|
||||||
|
SPO_MAP));
|
||||||
|
|
||||||
for (dy = 0; dy < max_hig; dy++)
|
for (dy = 0; dy < max_hig; dy++)
|
||||||
Free(tmpmap[dy]);
|
Free(tmpmap[dy]);
|
||||||
|
|||||||
Reference in New Issue
Block a user