remove the code to silence lint

Warning facilities on recent compilers are incredibly improved,
so the code to silence "good-old" lint is much less sense.
This commit is contained in:
SHIRAKATA Kentaro
2022-11-19 00:49:11 -08:00
committed by PatR
parent 7d55e71d24
commit 0d441b0c2f
13 changed files with 4 additions and 76 deletions
-18
View File
@@ -39,18 +39,6 @@ extern void panic(const char *, ...);
long * long *
alloc(unsigned int lth) alloc(unsigned int lth)
{ {
#ifdef LINT
/*
* a ridiculous definition, suppressing
* "possible pointer alignment problem" for (long *) malloc()
* from lint
*/
long dummy = ftell(stderr);
if (lth)
dummy = 0; /* make sure arg is used */
return &dummy;
#else
register genericptr_t ptr; register genericptr_t ptr;
ptr = malloc(lth); ptr = malloc(lth);
@@ -59,18 +47,12 @@ alloc(unsigned int lth)
panic("Memory allocation failure; cannot get %u bytes", lth); panic("Memory allocation failure; cannot get %u bytes", lth);
#endif #endif
return (long *) ptr; return (long *) ptr;
#endif
} }
/* realloc() call that might get substituted by nhrealloc(p,n,file,line) */ /* realloc() call that might get substituted by nhrealloc(p,n,file,line) */
long * long *
re_alloc(long *oldptr, unsigned int newlth) re_alloc(long *oldptr, unsigned int newlth)
{ {
/*
* If LINT support ever gets resurrected,
* we'll probably need some hackery here.
*/
long *newptr = (long *) realloc((genericptr_t) oldptr, (size_t) newlth); long *newptr = (long *) realloc((genericptr_t) oldptr, (size_t) newlth);
#ifndef MONITOR_HEAP #ifndef MONITOR_HEAP
/* "extend to": assume it won't ever fail if asked to shrink */ /* "extend to": assume it won't ever fail if asked to shrink */
-4
View File
@@ -312,12 +312,8 @@ dog_eat(struct monst *mtmp,
/* It's a reward if it's DOGFOOD and the player dropped/threw it. /* It's a reward if it's DOGFOOD and the player dropped/threw it.
We know the player had it if invlet is set. -dlc */ We know the player had it if invlet is set. -dlc */
if (dogfood(mtmp, obj) == DOGFOOD && obj->invlet) if (dogfood(mtmp, obj) == DOGFOOD && obj->invlet)
#ifdef LINT
edog->apport = 0;
#else
edog->apport += (int) (200L / ((long) edog->dropdist + g.moves edog->apport += (int) (200L / ((long) edog->dropdist + g.moves
- edog->droptime)); - edog->droptime));
#endif
if (mtmp->data == &mons[PM_RUST_MONSTER] && obj->oerodeproof) { if (mtmp->data == &mons[PM_RUST_MONSTER] && obj->oerodeproof) {
/* The object's rustproofing is gone now */ /* The object's rustproofing is gone now */
if (obj->unpaid) if (obj->unpaid)
-2
View File
@@ -365,9 +365,7 @@ done2(void)
done_stopprint++; done_stopprint++;
} }
#endif #endif
#ifndef LINT
done(QUIT); done(QUIT);
#endif
return ECMD_OK; return ECMD_OK;
} }
-5
View File
@@ -414,13 +414,8 @@ moverock(void)
} }
{ {
#ifdef LINT /* static long lastmovetime; */
long lastmovetime;
lastmovetime = 0;
#else
/* note: reset to zero after save/restore cycle */ /* note: reset to zero after save/restore cycle */
static NEARDATA long lastmovetime; static NEARDATA long lastmovetime;
#endif
dopush: dopush:
what = the(xname(otmp)); what = the(xname(otmp));
if (!u.usteed) { if (!u.usteed) {
+4 -10
View File
@@ -79,12 +79,6 @@
void nh_snprintf (const char *, int, char *, size_t, void nh_snprintf (const char *, int, char *, size_t,
const char *, ...) const char *, ...)
=*/ =*/
#ifdef LINT
#define Static /* pacify lint */
#else
#define Static static
#endif
static boolean pmatch_internal(const char *, const char *, boolean, static boolean pmatch_internal(const char *, const char *, boolean,
const char *); const char *);
@@ -371,7 +365,7 @@ strcasecpy(char *dst, const char *src)
char * char *
s_suffix(const char *s) s_suffix(const char *s)
{ {
Static char buf[BUFSZ]; static char buf[BUFSZ];
Strcpy(buf, s); Strcpy(buf, s);
if (!strcmpi(buf, "it")) /* it -> its */ if (!strcmpi(buf, "it")) /* it -> its */
@@ -495,7 +489,7 @@ tabexpand(
char * char *
visctrl(char c) visctrl(char c)
{ {
Static char visctrl_bufs[VISCTRL_NBUF][5]; static char visctrl_bufs[VISCTRL_NBUF][5];
static int nbuf = 0; static int nbuf = 0;
register int i = 0; register int i = 0;
char *ccc = visctrl_bufs[nbuf]; char *ccc = visctrl_bufs[nbuf];
@@ -638,7 +632,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL /* one compiler complains about
char * char *
sitoa(int n) sitoa(int n)
{ {
Static char buf[13]; static char buf[13];
Sprintf(buf, (n < 0) ? "%d" : "+%d", n); Sprintf(buf, (n < 0) ? "%d" : "+%d", n);
return buf; return buf;
@@ -1015,7 +1009,7 @@ getyear(void)
char * char *
yymmdd(time_t date) yymmdd(time_t date)
{ {
Static char datestr[10]; static char datestr[10];
struct tm *lt; struct tm *lt;
if (date == 0) if (date == 0)
-4
View File
@@ -2561,11 +2561,7 @@ xprname(struct obj *obj,
long cost, /* cost (for inventory of unpaid or expended items) */ long cost, /* cost (for inventory of unpaid or expended items) */
long quan) /* if non-0, print this quantity, not obj->quan */ long quan) /* if non-0, print this quantity, not obj->quan */
{ {
#ifdef LINT /* handle static char li[BUFSZ]; */
char li[BUFSZ];
#else
static char li[BUFSZ]; static char li[BUFSZ];
#endif
boolean use_invlet = (flags.invlet_constant boolean use_invlet = (flags.invlet_constant
&& let != CONTAINED_SYM && let != HANDS_SYM); && let != CONTAINED_SYM && let != HANDS_SYM);
long savequan = 0; long savequan = 0;
-3
View File
@@ -112,9 +112,6 @@ fightm(register struct monst *mtmp)
{ {
register struct monst *mon, *nmon; register struct monst *mon, *nmon;
int result, has_u_swallowed; int result, has_u_swallowed;
#ifdef LINT
nmon = 0;
#endif
/* perhaps the monster will resist Conflict */ /* perhaps the monster will resist Conflict */
if (resist_conflict(mtmp)) if (resist_conflict(mtmp))
return 0; return 0;
-8
View File
@@ -49,13 +49,6 @@ static void mk_knox_portal(coordxy, coordxy);
static int QSORTCALLBACK static int QSORTCALLBACK
mkroom_cmp(const genericptr vx, const genericptr vy) mkroom_cmp(const genericptr vx, const genericptr vy)
{ {
#ifdef LINT
/* lint complains about possible pointer alignment problems, but we know
that vx and vy are always properly aligned. Hence, the following
bogus definition:
*/
return (vx == vy) ? 0 : -1;
#else
register const struct mkroom *x, *y; register const struct mkroom *x, *y;
x = (const struct mkroom *) vx; x = (const struct mkroom *) vx;
@@ -63,7 +56,6 @@ mkroom_cmp(const genericptr vx, const genericptr vy)
if (x->lx < y->lx) if (x->lx < y->lx)
return -1; return -1;
return (x->lx > y->lx); return (x->lx > y->lx);
#endif /* LINT */
} }
/* Return TRUE if a door placed at (x, y) which otherwise passes okdoor() /* Return TRUE if a door placed at (x, y) which otherwise passes okdoor()
-2
View File
@@ -4660,9 +4660,7 @@ newcham(
/* set level and hit points */ /* set level and hit points */
newmonhp(mtmp, monsndx(mdat)); newmonhp(mtmp, monsndx(mdat));
/* new hp: same fraction of max as before */ /* new hp: same fraction of max as before */
#ifndef LINT
mtmp->mhp = (int) (((long) hpn * (long) mtmp->mhp) / (long) hpd); mtmp->mhp = (int) (((long) hpn * (long) mtmp->mhp) / (long) hpd);
#endif
/* sanity check (potential overflow) */ /* sanity check (potential overflow) */
if (mtmp->mhp < 0 || mtmp->mhp > mtmp->mhpmax) if (mtmp->mhp < 0 || mtmp->mhp > mtmp->mhpmax)
mtmp->mhp = mtmp->mhpmax; mtmp->mhp = mtmp->mhpmax;
-10
View File
@@ -73,17 +73,12 @@ rn2_on_display_rng(register int x)
#else /* USE_ISAAC64 */ #else /* USE_ISAAC64 */
/* "Rand()"s definition is determined by [OS]conf.h */ /* "Rand()"s definition is determined by [OS]conf.h */
#if defined(LINT) && defined(UNIX) /* rand() is long... */
extern int rand(void);
#define RND(x) (rand() % x)
#else /* LINT */
#if defined(UNIX) || defined(RANDOM) #if defined(UNIX) || defined(RANDOM)
#define RND(x) ((int) (Rand() % (long) (x))) #define RND(x) ((int) (Rand() % (long) (x)))
#else #else
/* Good luck: the bottom order bits are cyclic. */ /* Good luck: the bottom order bits are cyclic. */
#define RND(x) ((int) ((Rand() >> 3) % (x))) #define RND(x) ((int) ((Rand() >> 3) % (x)))
#endif #endif
#endif /* LINT */
int int
rn2_on_display_rng(register int x) rn2_on_display_rng(register int x)
{ {
@@ -216,13 +211,8 @@ rne(register int x)
int int
rnz(int i) rnz(int i)
{ {
#ifdef LINT
int x = i;
int tmp = 1000;
#else
register long x = (long) i; register long x = (long) i;
register long tmp = 1000L; register long tmp = 1000L;
#endif
tmp += rn2(1000); tmp += rn2(1000);
tmp *= rne(4); tmp *= rne(4);
-4
View File
@@ -25,11 +25,7 @@ equipname(register struct obj* otmp)
long long
somegold(long lmoney) somegold(long lmoney)
{ {
#ifdef LINT /* long conv. ok */
int igold = 0;
#else
int igold = (lmoney >= (long) LARGEST_INT) ? LARGEST_INT : (int) lmoney; int igold = (lmoney >= (long) LARGEST_INT) ? LARGEST_INT : (int) lmoney;
#endif
if (igold < 50) if (igold < 50)
; /* all gold */ ; /* all gold */
-4
View File
@@ -4366,11 +4366,7 @@ end_engulf(void)
static int static int
gulpum(struct monst *mdef, struct attack *mattk) gulpum(struct monst *mdef, struct attack *mattk)
{ {
#ifdef LINT /* static char msgbuf[BUFSZ]; */
char msgbuf[BUFSZ];
#else
static char msgbuf[BUFSZ]; /* for g.nomovemsg */ static char msgbuf[BUFSZ]; /* for g.nomovemsg */
#endif
register int tmp; register int tmp;
register int dam = d((int) mattk->damn, (int) mattk->damd); register int dam = d((int) mattk->damn, (int) mattk->damd);
boolean fatal_gulp, u_digest = digests(g.youmonst.data); boolean fatal_gulp, u_digest = digests(g.youmonst.data);
-2
View File
@@ -136,9 +136,7 @@ int has_colors(void);
#if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \ #if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \
|| defined(UNIXPC) || defined(SVR4)) || defined(UNIXPC) || defined(SVR4))
#ifndef LINT
extern /* it is defined in libtermlib (libtermcap) */ extern /* it is defined in libtermlib (libtermcap) */
#endif
short ospeed; /* terminal baudrate; set by gettty */ short ospeed; /* terminal baudrate; set by gettty */
#else #else
short ospeed = 0; /* gets around "not defined" error message */ short ospeed = 0; /* gets around "not defined" error message */