used, unused variables

some variables marked as unused, are now actually used
some unused variables are eliminated or commented out
This commit is contained in:
nhmall
2024-03-16 12:53:58 -04:00
parent cad4d87101
commit 295d6e257c
10 changed files with 24 additions and 21 deletions
+7 -1
View File
@@ -26,9 +26,15 @@ staticfn void debug_fields(const char *);
staticfn void dump_enums(void); staticfn void dump_enums(void);
#endif #endif
#ifdef CRASHREPORT
#define USED_FOR_CRASHREPORT
#else
#define USED_FOR_CRASHREPORT UNUSED
#endif
/*ARGSUSED*/ /*ARGSUSED*/
void void
early_init(int argc UNUSED, char *argv[] UNUSED) early_init(int argc USED_FOR_CRASHREPORT, char *argv[] USED_FOR_CRASHREPORT)
{ {
#ifdef CRASHREPORT #ifdef CRASHREPORT
/* Do this as early as possible, but let ports do other things first. */ /* Do this as early as possible, but let ports do other things first. */
+1 -2
View File
@@ -1370,7 +1370,7 @@ evaluate_and_notify_windowport(
boolean *valsetlist, boolean *valsetlist,
int idx) int idx)
{ {
int i, fld, updated = 0, notpresent UNUSED = 0; int i, fld, updated = 0;
/* /*
* Now pass the changed values to window port. * Now pass the changed values to window port.
@@ -1384,7 +1384,6 @@ evaluate_and_notify_windowport(
|| ((fld == BL_XP || i == BL_EXP) && Upolyd) || ((fld == BL_XP || i == BL_EXP) && Upolyd)
|| ((fld == BL_VERS) && !flags.showvers) || ((fld == BL_VERS) && !flags.showvers)
) { ) {
notpresent++;
continue; continue;
} }
if (eval_notify_windowport_field(fld, valsetlist, idx)) if (eval_notify_windowport_field(fld, valsetlist, idx))
-4
View File
@@ -2048,11 +2048,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
void void
silly_thing(const char *word, silly_thing(const char *word,
#ifdef OBSOLETE_HANDLING
struct obj *otmp) struct obj *otmp)
#else
struct obj *otmp UNUSED)
#endif
{ {
#ifdef OBSOLETE_HANDLING #ifdef OBSOLETE_HANDLING
/* 'P','R' vs 'W','T' handling is obsolete */ /* 'P','R' vs 'W','T' handling is obsolete */
+2 -1
View File
@@ -487,7 +487,7 @@ do_improvisation(struct obj *instr)
struct obj itmp; struct obj itmp;
boolean mundane = FALSE, same_old_song = FALSE; boolean mundane = FALSE, same_old_song = FALSE;
static char my_goto_song[] = {'C', '\0'}, static char my_goto_song[] = {'C', '\0'},
*improvisation SOUNDLIBONLY = my_goto_song; *improvisation = my_goto_song;
itmp = *instr; itmp = *instr;
itmp.oextra = (struct oextra *) 0; /* ok on this copy as instr maintains itmp.oextra = (struct oextra *) 0; /* ok on this copy as instr maintains
@@ -706,6 +706,7 @@ do_improvisation(struct obj *instr)
impossible("What a weird instrument (%d)!", instr->otyp); impossible("What a weird instrument (%d)!", instr->otyp);
return 0; return 0;
} }
nhUse(improvisation);
return 2; /* That takes time */ return 2; /* That takes time */
} }
+3 -3
View File
@@ -1970,7 +1970,7 @@ optfn_map_mode(int optidx, int req, boolean negated, char *opts, char *op)
/* all the key assignment options for menu_* commands are identical /* all the key assignment options for menu_* commands are identical
but optlist.h treats them as distinct rather than sharing one */ but optlist.h treats them as distinct rather than sharing one */
staticfn int staticfn int
shared_menu_optfn(int optidx UNUSED, int req, boolean negated UNUSED, shared_menu_optfn(int optidx UNUSED, int req, boolean negated,
char *opts, char *op) char *opts, char *op)
{ {
if (req == do_init) { if (req == do_init) {
@@ -3969,7 +3969,7 @@ extern const char *const known_restrictions[]; /* symbols.c */
staticfn int staticfn int
optfn_symset( optfn_symset(
int optidx UNUSED, int optidx,
int req, int req,
boolean negated UNUSED, boolean negated UNUSED,
char *opts, char *opts,
@@ -8621,7 +8621,7 @@ doset(void) /* changing options via menu by Per Liboriussen */
(void) parseoptions(buf, setinitial, fromfile); (void) parseoptions(buf, setinitial, fromfile);
} else { } else {
/* compound option */ /* compound option */
int k = opt_indx, reslt UNUSED; int k = opt_indx, reslt;
if (allopt[k].has_handler && allopt[k].optfn) { if (allopt[k].has_handler && allopt[k].optfn) {
reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler, reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler,
+2 -2
View File
@@ -5890,7 +5890,7 @@ lspo_wallify(lua_State *L)
/* reset_level is only needed for testing purposes */ /* reset_level is only needed for testing purposes */
int int
lspo_reset_level(lua_State *L UNUSED) lspo_reset_level(lua_State *L)
{ {
boolean wtower = In_W_tower(u.ux, u.uy, &u.uz); boolean wtower = In_W_tower(u.ux, u.uy, &u.uz);
@@ -5906,7 +5906,7 @@ lspo_reset_level(lua_State *L UNUSED)
/* finalize_level is only needed for testing purposes */ /* finalize_level is only needed for testing purposes */
int int
lspo_finalize_level(lua_State *L UNUSED) lspo_finalize_level(lua_State *L)
{ {
boolean wtower = In_W_tower(u.ux, u.uy, &u.uz); boolean wtower = In_W_tower(u.ux, u.uy, &u.uz);
int i; int i;
+2 -2
View File
@@ -3724,7 +3724,7 @@ mhitm_ad_pest(
void void
mhitm_ad_deth( mhitm_ad_deth(
struct monst *magr, struct monst *magr,
struct attack *mattk UNUSED, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm) struct monst *mdef, struct mhitm_data *mhm)
{ {
struct permonst *pd = mdef->data; struct permonst *pd = mdef->data;
@@ -3831,7 +3831,7 @@ do_stone_u(struct monst *mtmp)
void void
do_stone_mon( do_stone_mon(
struct monst *magr, struct monst *magr,
struct attack *mattk UNUSED, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm) struct monst *mdef, struct mhitm_data *mhm)
{ {
struct permonst *pd = mdef->data; struct permonst *pd = mdef->data;
+3 -3
View File
@@ -2176,7 +2176,7 @@ macronamelimit(char *name, int pref)
void void
do_objs(void) do_objs(void)
{ {
int i, sum UNUSED = 0; int i /*, sum = 0 */;
char *c, *objnam; char *c, *objnam;
int nspell = 0; int nspell = 0;
int prefix = 0; int prefix = 0;
@@ -2216,7 +2216,7 @@ do_objs(void)
} }
#endif /*0*/ #endif /*0*/
class = objects[i].oc_class; class = objects[i].oc_class;
sum = 0; /* sum = 0; */
} }
for (c = objnam; *c; c++) for (c = objnam; *c; c++)
@@ -2289,7 +2289,7 @@ do_objs(void)
Fprintf(ofp, "%s\t%d\n", macronamelimit(objnam, prefix), i); Fprintf(ofp, "%s\t%d\n", macronamelimit(objnam, prefix), i);
prefix = 0; prefix = 0;
sum += objects[i].oc_prob; /* sum += objects[i].oc_prob; */
if (sumerr) if (sumerr)
break; break;
+2 -2
View File
@@ -99,7 +99,7 @@ set_window_position(int *winx, int *winy, int *winw, int *winh,
void void
curses_create_main_windows(void) curses_create_main_windows(void)
{ {
int min_message_height UNUSED = 1; /* int min_message_height = 1; */
int message_orientation = 0; int message_orientation = 0;
int status_orientation = 0; int status_orientation = 0;
int border_space = 0; int border_space = 0;
@@ -133,7 +133,7 @@ curses_create_main_windows(void)
} }
if ((term_cols - border_space) < COLNO) { if ((term_cols - border_space) < COLNO) {
min_message_height++; /* min_message_height++; */
} }
/* Determine status window orientation */ /* Determine status window orientation */
+2 -1
View File
@@ -301,7 +301,7 @@ draw_horizontal(boolean border)
cap_and_hunger, exp_points, sho_score, sho_vers, cap_and_hunger, exp_points, sho_score, sho_vers,
/* both height and width get their values set, /* both height and width get their values set,
* but only width gets used in this function */ * but only width gets used in this function */
height UNUSED, width, w, xtra, clen, x, y, t, ex, ey, height, width, w, xtra, clen, x, y, t, ex, ey,
condstart = 0, conddummy = 0, versstart = 0; condstart = 0, conddummy = 0, versstart = 0;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
int coloridx = NO_COLOR, attrmask = 0; int coloridx = NO_COLOR, attrmask = 0;
@@ -672,6 +672,7 @@ draw_horizontal(boolean border)
} /* i (fld) */ } /* i (fld) */
wclrtoeol(win); /* [superfluous? draw_status() calls werase()] */ wclrtoeol(win); /* [superfluous? draw_status() calls werase()] */
} /* j (line) */ } /* j (line) */
nhUse(height);
return; return;
} }