Remove workarounds for ancient compilers

This commit is contained in:
Pasi Kallinen
2020-04-03 08:21:08 +03:00
parent 8301fc06df
commit 5f9714bf92
15 changed files with 4 additions and 135 deletions

View File

@@ -28,7 +28,6 @@
#ifdef _DCC
#include <stdlib.h>
#define _SIZE_T
#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */
#endif
#ifndef __GNUC__

View File

@@ -600,15 +600,8 @@ struct levelflags {
typedef struct {
struct rm locations[COLNO][ROWNO];
#ifndef MICROPORT_BUG
struct obj *objects[COLNO][ROWNO];
struct monst *monsters[COLNO][ROWNO];
#else
struct obj *objects[1][ROWNO];
char *yuk1[COLNO - 1][ROWNO];
struct monst *monsters[1][ROWNO];
char *yuk2[COLNO - 1][ROWNO];
#endif
struct obj *objlist;
struct obj *buriedobjlist;
struct monst *monlist;

View File

@@ -79,9 +79,5 @@ extern int FDECL(strncmpi, (const char *, const char *, size_t));
extern boolean colors_changed; /* in tos.c */
#endif
#ifdef __GNUC__
#define GCC_BUG /* correct a gcc bug involving double for loops */
#endif
#endif /* TOSCONF_H */
#endif /* TOS */

View File

@@ -70,18 +70,6 @@
* Linux, Solaris 2.x
*/
/* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for
X11 on SunOS 4.1.x, x>= 2. Do not define
for other X11 implementations. */
/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
/* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */
/* #define MICROPORT_BUG */ /* problems with large arrays in structs */
/* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
run with Microport Sys V/AT version 2.4.
By Jay Maynard */
/* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization
*/
/* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
is available from your system */

View File

@@ -1704,16 +1704,7 @@ int
dosearch0(aflag)
register int aflag; /* intrinsic autosearch vs explicit searching */
{
#ifdef GCC_BUG
/* Some old versions of gcc seriously muck up nested loops. If you get
* strange crashes while searching in a version compiled with gcc, try
* putting #define GCC_BUG in *conf.h (or adding -DGCC_BUG to CFLAGS in
* the makefile).
*/
volatile xchar x, y;
#else
register xchar x, y;
#endif
xchar x, y;
register struct trap *trap;
register struct monst *mtmp;

View File

@@ -1330,16 +1330,7 @@ int mmflags;
if (uwep && uwep->oartifact == ART_EXCALIBUR)
mtmp->mpeaceful = mtmp->mtame = FALSE;
}
#ifndef DCC30_BUG
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0)
#else
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
same expression. */
if (mndx == PM_LONG_WORM
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0))
#endif
{
/* we can now create worms with tails - 11/91 */
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0) {
initworm(mtmp, rn2(5));
if (count_wsegs(mtmp))
place_worm_tail_randomly(mtmp, x, y);

View File

@@ -598,13 +598,6 @@ clear_level_structures()
lev = &levl[x][0];
for (y = 0; y < ROWNO; y++) {
*lev++ = zerorm;
/*
* These used to be '#if MICROPORT_BUG',
* with use of memset(0) for '#if !MICROPORT_BUG' below,
* but memset is not appropriate for initializing pointers,
* so do these g.level.objects[][] and level.monsters[][]
* initializations unconditionally.
*/
g.level.objects[x][y] = (struct obj *) 0;
g.level.monsters[x][y] = (struct monst *) 0;
}

View File

@@ -3,11 +3,6 @@
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
/* If you're using precompiled headers, you don't want this either */
#ifdef MICROPORT_BUG
#define MKROOM_H
#endif
#include "hack.h"
#include "mfndpos.h"
#include <ctype.h>
@@ -3895,16 +3890,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
unstuck(mtmp);
}
#ifndef DCC30_BUG
if (mdat == &mons[PM_LONG_WORM] && (mtmp->wormno = get_wormno()) != 0) {
#else
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
* same expression.
*/
if (mdat == &mons[PM_LONG_WORM]
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0)) {
#endif
/* we can now create worms with tails - 11/91 */
initworm(mtmp, rn2(5));
place_worm_tail_randomly(mtmp, mtmp->mx, mtmp->my);
}

View File

@@ -1147,16 +1147,8 @@ register struct trobj *trop;
if (obj->oclass == SPBOOK_CLASS && obj->otyp != SPE_BLANK_PAPER)
initialspell(obj);
#if !defined(PYRAMID_BUG) && !defined(MAC)
if (--trop->trquan)
continue; /* make a similar object */
#else
if (trop->trquan) { /* check if zero first */
--trop->trquan;
if (trop->trquan)
continue; /* make a similar object */
}
#endif
trop++;
}
}

View File

@@ -305,9 +305,6 @@ xchar *rx, *ry;
void
invault()
{
#ifdef BSD_43_BUG
int dummy; /* hack to avoid schain botch */
#endif
struct monst *guard;
boolean gsensed;
int trycount, vaultroom = (int) vault_occupied(u.urooms);

View File

@@ -136,11 +136,5 @@ II.B.3. Compiling NetHack with the commercial version of DICE
however, this is not recommended, and you should upgrade to the
commercial version.)
DICE 3.0 (the first commercial release) has a couple of bugs in it which
turn up in several of the NetHack sources; the DCC30_BUG define fixes
them. If you have a more recent version of the compiler, you may be
able to compile without this (and get slightly more efficient code) by
commenting out the define in amiconf.h.
During compilation, DICE will output a lot of warnings; they can be
safely ignored.

View File

@@ -229,7 +229,7 @@ Notes:
config.h: UNIX, TTY_GRAPHICS
unixconf.h: SYSV, SVR4, TERMINFO, POSIX_JOB_CONTROL, POSIX_TYPES
X11_GRAPHICS does work. Do not define OPENWINBUG. You may safely define
X11_GRAPHICS does work. You may safely define
NETWORK, TEXTCOLOR if desired. Other #defines in these files may be
defined too, as needed. Just make sure that the set mentioned here are
not misdefined, or your compile will fail (do _not_ define BSD or SUNOS4).

View File

@@ -128,39 +128,6 @@ support is only a small, optional, part of nethack, and the Makefile is
needed for systems that don't use X11.
Notes for Sun's OpenWindows:
1. For OpenWindows 3.0 (NOT 2.x), define OPENWINBUG in include/unixconf.h.
The library bug from SunOS 4.1.x is fixed in Solaris 2.x (or when
proper Sun patches have been applied to 4.1.x), so it is also
unnecessary there. (Defining it when unnecessary causes the same
problem being avoided when it is necessary. :-)
2. In addition to the changes suggested by the comments in src/Makefile,
-- for OpenWindows 2.x and 3.0 (NOT 3.1) (i.e., versions for SunOS 4.x),
add -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib to LFLAGS,
and -lm to WINX11LIB in src/Makefile.
-- for OpenWindows 3.1 (i.e., versions for Solaris 2.x), add
-I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib -L/usr/ccs/lib
-R/usr/openwin/lib to LFLAGS, and -lsocket -lnsl -lm
to WINX11LIB in src/Makefile.
(Naturally, if your OpenWindows is installed elsewhere, adapt the
openwin paths.) This will allow you to create a game executable.
3. Run the fonts through convertfont and run bldfamily on the directory.
Now you must let your X server know where to find the fonts. For a
personal installation, the simplest thing is to include the directory
of the fonts in the environment variable FONTPATH, as set in your
.profile or .login before starting the server. For a multi-user
installation, you have the various "xset fp+" options outlined
above for standard X.
4. Something must still be done with the NetHack.ad file -- all three
of the possibilities mentioned for standard X11 should work.
Notes for AIX 3.2:
1. AIX 3.2 includes the Athena Widget Toolkit library (and other things)
under the /usr/lpp/X11/Xamples tree, so you will have to add
@@ -170,8 +137,7 @@ Notes for AIX 3.2:
Notes for XFree86 - (on linux and BSD386 platforms)
1. Edit src/Makefile for linux/BSD386. Even though you use the
Open Look Window manager, do not define OPENWINBUG. Use the
1. Edit src/Makefile for linux/BSD386. Use the
standard X11 object and library options.
2. Follow the standard installation directions defined above.

View File

@@ -2609,19 +2609,6 @@ int dir;
if (dir != WININIT)
return;
#ifdef OPENWINBUG
/* With the OpenWindows 3.0 libraries and the SunOS 4.1.2 ld, these
* two routines will not be found when linking. An apparently correct
* executable is produced, along with nasty messages and a failure code
* returned to make. The routines are in the static libXmu.a and
* libXmu.sa.4.0, but not in libXmu.so.4.0. Rather than fiddle with
* static linking, we do this.
*/
if (rn2(2) > 2) { /* i.e., FALSE that an optimizer probably can't find */
get_wmShellWidgetClass();
get_applicationShellWidgetClass();
}
#endif
return;
}

View File

@@ -10,11 +10,7 @@
#include "wintty.h"
#include "tcap.h"
#ifdef MICROPORT_286_BUG
#define Tgetstr(key) (tgetstr(key, tbuf))
#else
#define Tgetstr(key) (tgetstr(key, &tbufptr))
#endif /* MICROPORT_286_BUG **/
static char *FDECL(s_atr2str, (int));
static char *FDECL(e_atr2str, (int));