whitelist several non-literal format strings

djgpp cross-compiler was griping about several.

This also removes these lines from sys/unix/hints/include/compiler.370.
    CFLAGS+=-Wno-format-nonliteral
    CCXXFLAGS+=-Wno-format-nonliteral

-Wformat-nonliteral should not be incompatible with the printf
argument-checking capabilities on literal format strings and there
shouldn't be any new warnings created.

-- &< --

artifact.c: In function 'artifact_hit':
artifact.c:1309:23: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1309 |                       mon_nam(mdef));
      |                       ^~~~~~~
artifact.c:1328:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1328 |                 pline(behead_msg[rn2(SIZE(behead_msg))], wepdesc, "you");
      |                 ^~~~~

ball.c: In function 'drop_ball':
ball.c:896:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  896 |                 pline(pullmsg, "pit");
      |                 ^~~~~
ball.c:899:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  899 |                 pline(pullmsg, "web");
      |                 ^~~~~
ball.c:904:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  904 |                 pline(pullmsg, hliquid("lava"));
      |                 ^~~~~
ball.c:908:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  908 |                 pline(pullmsg, "bear trap");
      |                 ^~~~~

dig.c: In function 'liquid_flow':
dig.c:747:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  747 |         pline(fillmsg, hliquid(typ == LAVAPOOL ? "lava" : "water"));
      |         ^~~~~

fountain.c: In function 'floating_above':
fountain.c:28:5: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
   28 |     You(umsg, what);
      |     ^~~

invent.c: In function 'hold_another_object':
invent.c:1018:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1018 |                 pline(drop_fmt, drop_arg);
      |                 ^~~~~
invent.c:1073:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1073 |         pline(drop_fmt, drop_arg);
      |         ^~~~~
invent.c: In function 'silly_thing':
invent.c:1811:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1811 |         pline(silly_thing_to, word);
      |         ^~~~~

lock.c: In function 'pick_lock':
lock.c:375:19: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  375 |             pline(no_longer, "hold the", what);
      |                   ^~~~~~~~~
lock.c:379:19: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  379 |             pline(no_longer, "reach the", "lock");
      |                   ^~~~~~~~~
lock.c: In function 'pick_lock':
lock.c:375:19: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  375 |             pline(no_longer, "hold the", what);
      |                   ^~~~~~~~~
lock.c:379:19: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  379 |             pline(no_longer, "reach the", "lock");
      |                   ^~~~~~~~~
mcastu.c: In function 'cast_cleric_spell':
mcastu.c:670:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  670 |             pline(fmt, Monnam(mtmp), what);
      |             ^~~~~

mhitu.c: In function 'hitmsg':
mhitu.c:68:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
   68 |             pline(pfmt, Monst_name);
      |             ^~~~~

mkobj.c: In function 'insane_object':
mkobj.c:2848:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2848 |         impossible(altfmt, mesg, fmt_ptr((genericptr_t) obj), where_name(obj),
      |                    ^~~~~~
mkobj.c:2852:20: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2852 |                    objnm);
      |                    ^~~~~

mon.c: In function 'mon_givit':
mon.c:1469:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1469 |         pline(msg, Monnam(mtmp));
      |         ^~~~~
mon.c: In function 'mondead':
mon.c:2485:33: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2485 |                                 | SUPPRESS_INVISIBLE), FALSE));
      |                                 ^

muse.c: In function 'mon_reflects':
muse.c:2438:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2438 |             pline(str, s_suffix(mon_nam(mon)), "shield");
      |             ^~~~~
muse.c:2445:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2445 |             pline(str, s_suffix(mon_nam(mon)), "weapon");
      |             ^~~~~
muse.c:2450:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2450 |             pline(str, s_suffix(mon_nam(mon)), "amulet");
      |             ^~~~~
muse.c:2458:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2458 |             pline(str, s_suffix(mon_nam(mon)), "armor");
      |             ^~~~~
muse.c:2464:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2464 |             pline(str, s_suffix(mon_nam(mon)), "scales");
      |             ^~~~~
muse.c: In function 'ureflects':
muse.c:2476:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2476 |             pline(fmt, str, "shield");
      |             ^~~~~
muse.c:2483:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2483 |             pline(fmt, str, "weapon");
      |             ^~~~~
muse.c:2487:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2487 |             pline(fmt, str, "medallion");
      |             ^~~~~
muse.c:2493:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2493 |             pline(fmt, str, uskin ? "luster" : "armor");
      |             ^~~~~
muse.c:2497:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2497 |             pline(fmt, str, "scales");
      |             ^~~~~

polyself.c: In function 'polyman':
polyself.c:201:5: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  201 |     urgent_pline(fmt, arg);
      |     ^~~~~~~~~~~~

potion.c: In function 'make_hallucinated':
potion.c:423:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  423 |             pline(message, verb);
      |             ^~~~~
potion.c: In function 'peffect_gain_level':
potion.c:1033:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1033 |                 You(riseup, ceiling(u.ux, u.uy));
      |                 ^~~
potion.c:1044:21: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1044 |                     You(riseup, ceiling(u.ux, u.uy));
      |                     ^~~

priest.c: In function 'intemple':
priest.c:487:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  487 |                 You(msg1, msg2);
      |                 ^~~

read.c: In function 'doread':
read.c:522:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  522 |         pline(silly_thing_to, "read");
      |         ^~~~~

shk.c: In function 'shk_names_obj':
shk.c:2576:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2576 |         pline(fmtbuf, obj_name, (obj->quan > 1L) ? "them" : "it", amt,
      |               ^~~~~~
shk.c:2579:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2579 |         You(fmt, obj_name, amt, plur(amt), arg);
      |         ^~~
shk.c: In function 'shk_chat':
shk.c:4506:13: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 4506 |             pline(Izchak_speaks[rn2(SIZE(Izchak_speaks))], shkname(shkp));
      |             ^~~~~
shk.c: In function 'check_unpaid_usage':
shk.c:4633:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 4633 |         verbalize(fmt, arg1, arg2, tmp, currency(tmp));
      |         ^~~~~~~~~

sounds.c: In function 'dosounds':
sounds.c:66:21: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
   66 |                     pline(throne_msg[2], uhis());
      |                     ^~~~~
sounds.c:259:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  259 |                 You_hear(msg, halu_gname(EPRI(mtmp)->shralign));
      |                 ^~~~~~~~

timeout.c: In function 'choke_dialogue':
timeout.c:269:26: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  269 |                          body_part(NECK));
      |                          ^~~~~~~~~
timeout.c:274:17: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  274 |                 urgent_pline(str, hcolor(NH_BLUE));
      |                 ^~~~~~~~~~~~
timeout.c: In function 'levitation_dialogue':
timeout.c:339:26: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  339 |                          danger ? surface(u.ux, u.uy) : "air");
      |                          ^~~~~~
timeout.c: In function 'slime_dialogue':
timeout.c:379:34: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  379 |                     urgent_pline(buf, hcolor(NH_GREEN));
      |                                  ^~~
timeout.c:381:30: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  381 |                 urgent_pline(buf, an(Hallucination ? rndmonnam(NULL)
      |                              ^~~

uhitm.c: In function 'hmon_hitmon':
uhitm.c:1398:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1398 |         pline(fmt, whom);
      |         ^~~~~
uhitm.c:1421:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1421 |         pline(fmt, whom);
      |         ^~~~~
uhitm.c: In function 'stumble_onto_mimic':
uhitm.c:5301:9: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 5301 |         pline(fmt, what);
      |         ^~~~~

../win/tty/wintty.c: In function 'tty_clear_nhwindow':
../win/tty/wintty.c:1649:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 1649 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_display_nhwindow':
../win/tty/wintty.c:2339:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2339 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_dismiss_nhwindow':
../win/tty/wintty.c:2432:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2432 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_destroy_nhwindow':
../win/tty/wintty.c:2477:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2477 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_curs':
../win/tty/wintty.c:2503:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2503 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_putsym':
../win/tty/wintty.c:2599:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2599 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_add_menu':
../win/tty/wintty.c:2967:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 2967 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_end_menu':
../win/tty/wintty.c:3032:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 3032 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
../win/tty/wintty.c: In function 'tty_select_menu':
../win/tty/wintty.c:3140:15: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
 3140 |         panic(winpanicstr, window);
      |               ^~~~~~~~~~~
This commit is contained in:
nhmall
2022-01-09 14:18:10 -05:00
parent 6ffcdac45f
commit e4e65c4b8b
22 changed files with 112 additions and 3 deletions

View File

@@ -1130,6 +1130,8 @@ Mb_hit(struct monst *magr, /* attacker */
return result;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* Function used when someone attacks someone else with an artifact
* weapon. Only adds the special (artifact) damage, and returns a 1 if it
* did something special (in which case the caller won't print the normal
@@ -1404,6 +1406,8 @@ artifact_hit(struct monst *magr, struct monst *mdef, struct obj *otmp,
return FALSE;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* getobj callback for object to be invoked */
static int
invoke_ok(struct obj *obj)

View File

@@ -865,6 +865,8 @@ drag_ball(xchar x, xchar y, int *bc_control,
return TRUE;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/*
* drop_ball()
*
@@ -955,6 +957,8 @@ drop_ball(xchar x, xchar y)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* ball&chain cause hero to randomly lose stuff from inventory */
static void
litter(void)

View File

@@ -726,6 +726,8 @@ digactualhole(int x, int y, struct monst *madeby, int ttyp)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
/*
* Called from dighole(), but also from do_break_wand()
* in apply.c.
@@ -760,6 +762,8 @@ liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp,
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* return TRUE if digging succeeded, FALSE otherwise */
boolean
dighole(boolean pit_only, boolean by_magic, coord *cc)

View File

@@ -12,6 +12,8 @@ static void dowaternymph(void);
static void gush(int, int, genericptr_t);
static void dofindgem(void);
DISABLE_WARNING_FORMAT_NONLITERAL
/* used when trying to dip in or drink from fountain or sink or pool while
levitating above it, or when trying to move downwards in that state */
void
@@ -28,6 +30,8 @@ floating_above(const char *what)
You(umsg, what);
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* Fountain of snakes! */
static void
dowatersnakes(void)

View File

@@ -984,6 +984,8 @@ carry_obj_effects(struct obj *obj)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* Add an item to the inventory unless we're fumbling or it refuses to be
* held (via touch_artifact), and give a message.
* If there aren't any free inventory slots, we'll drop it instead.
@@ -1081,6 +1083,8 @@ hold_another_object(struct obj *obj, const char *drop_fmt,
return (struct obj *) 0; /* might be gone */
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* useup() all of an item regardless of its quantity */
void
useupall(struct obj *obj)
@@ -1774,6 +1778,8 @@ getobj(const char *word,
return otmp;
}
DISABLE_WARNING_FORMAT_NONLITERAL
void
silly_thing(const char *word,
#ifdef OBSOLETE_HANDLING
@@ -1811,6 +1817,8 @@ silly_thing(const char *word,
pline(silly_thing_to, word);
}
RESTORE_WARNING_FORMAT_NONLITERAL
static int
ckvalidcat(struct obj *otmp)
{

View File

@@ -338,6 +338,8 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
return key ? key : pick ? pick : card ? card : 0;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* for doapply(); if player gives a direction or resumes an interrupted
previous attempt then it costs hero a move even if nothing ultimately
happens; when told "can't do that" before being asked for direction
@@ -600,6 +602,8 @@ pick_lock(struct obj *pick,
return PICKLOCK_DID_SOMETHING;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* the #force command - try to force a chest with your weapon */
int
doforce(void)

View File

@@ -531,6 +531,8 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum)
mdamageu(mtmp, dmg);
}
DISABLE_WARNING_FORMAT_NONLITERAL
static void
cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum)
{
@@ -753,6 +755,8 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum)
mdamageu(mtmp, dmg);
}
RESTORE_WARNING_FORMAT_NONLITERAL
static boolean
is_undirected_spell(unsigned int adtyp, int spellnum)
{

View File

@@ -21,6 +21,8 @@ static int passiveum(struct permonst *, struct monst *, struct attack *);
#define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5)
DISABLE_WARNING_FORMAT_NONLITERAL
void
hitmsg(struct monst *mtmp, struct attack *mattk)
{
@@ -69,6 +71,8 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* monster missed you */
static void
missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)

View File

@@ -2825,6 +2825,8 @@ where_name(struct obj *obj)
return obj_state_names[where];
}
DISABLE_WARNING_FORMAT_NONLITERAL
static void
insane_object(
struct obj *obj,
@@ -2853,6 +2855,7 @@ insane_object(
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* initialize a dummy obj with just enough info to allow some of the tests in
obj.h that take an obj pointer to work; used when applying a stethoscope

View File

@@ -1408,6 +1408,8 @@ meatcorpse(struct monst* mtmp) /* for purple worms and other voracious monsters
return 0;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* Maybe give an intrinsic to a monster from eating a corpse that confers it. */
void
mon_givit(struct monst* mtmp, struct permonst* ptr)
@@ -1469,6 +1471,8 @@ mon_givit(struct monst* mtmp, struct permonst* ptr)
pline(msg, Monnam(mtmp));
}
RESTORE_WARNING_FORMAT_NONLITERAL
void
mpickgold(register struct monst* mtmp)
{
@@ -2410,6 +2414,8 @@ lifesaved_monster(struct monst* mtmp)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
void
mondead(register struct monst* mtmp)
{
@@ -2569,6 +2575,8 @@ mondead(register struct monst* mtmp)
m_detach(mtmp, mptr);
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* TRUE if corpse might be dropped, magr may die if mon was swallowed */
boolean
corpse_chance(

View File

@@ -2428,6 +2428,8 @@ searches_for_item(struct monst* mon, struct obj* obj)
return FALSE;
}
DISABLE_WARNING_FORMAT_NONLITERAL
boolean
mon_reflects(struct monst* mon, const char* str)
{
@@ -2500,6 +2502,8 @@ ureflects(const char* fmt, const char* str)
return FALSE;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* cure mon's blindness (use_defensive, dog_eat, meatobj) */
void
mcureblindness(struct monst* mon, boolean verbos)

View File

@@ -165,6 +165,8 @@ check_strangling(boolean on)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* make a (new) human out of the player */
static void
polyman(const char *fmt, const char *arg)
@@ -233,6 +235,8 @@ polyman(const char *fmt, const char *arg)
see_monsters();
}
RESTORE_WARNING_FORMAT_NONLITERAL
void
change_sex(void)
{

View File

@@ -353,6 +353,8 @@ toggle_blindness(void)
learn_unseen_invent();
}
DISABLE_WARNING_FORMAT_NONLITERAL
boolean
make_hallucinated(
long xtime, /* nonzero if this is an attempt to turn on hallucination */
@@ -425,6 +427,8 @@ make_hallucinated(
return changed;
}
RESTORE_WARNING_FORMAT_NONLITERAL
void
make_deaf(long xtime, boolean talk)
{
@@ -1019,6 +1023,8 @@ peffect_blindness(struct obj *otmp)
(boolean) !Blind);
}
DISABLE_WARNING_FORMAT_NONLITERAL
static void
peffect_gain_level(struct obj *otmp)
{
@@ -1055,6 +1061,8 @@ peffect_gain_level(struct obj *otmp)
u.uexp = rndexp(TRUE);
}
RESTORE_WARNING_FORMAT_NONLITERAL
static void
peffect_healing(struct obj *otmp)
{

View File

@@ -403,6 +403,8 @@ findpriest(char roomno)
return (struct monst *) 0;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* called from check_special_room() when the player enters the temple room */
void
intemple(int roomno)
@@ -534,6 +536,8 @@ intemple(int roomno)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* reset the move counters used to limit temple entry feedback;
leaving the level and then returning yields a fresh start */
void

View File

@@ -324,6 +324,8 @@ read_ok(struct obj* obj)
return GETOBJ_DOWNPLAY;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* the #read command; read a scroll or spell book or various other things */
int
doread(void)
@@ -605,6 +607,8 @@ doread(void)
return ECMD_TIME;
}
RESTORE_WARNING_FORMAT_NONLITERAL
static void
stripspe(register struct obj* obj)
{

View File

@@ -2544,6 +2544,8 @@ bill_box_content(
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* shopkeeper tells you what you bought or sold, sometimes partly IDing it */
static void
shk_names_obj(
@@ -2580,6 +2582,8 @@ shk_names_obj(
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* decide whether a shopkeeper thinks an item belongs to her */
boolean
billable(
@@ -4422,6 +4426,8 @@ shk_embellish(register struct obj* itm, long cost)
return ".";
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* First 4 supplied by Ronen and Tamar, remainder by development team */
const char *Izchak_speaks[] = {
"%s says: 'These shopping malls give me a headache.'",
@@ -4510,6 +4516,8 @@ shk_chat(struct monst* shkp)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
static void
kops_gone(boolean silent)
{
@@ -4585,6 +4593,8 @@ cost_per_charge(
return tmp;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* Charge the player for partial use of an unpaid object.
*
* Note that bill_dummy_object() should be used instead
@@ -4636,6 +4646,8 @@ check_unpaid_usage(struct obj* otmp, boolean altusage)
ESHK(shkp)->debit += tmp;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* for using charges of unpaid objects "used in the normal manner" */
void
check_unpaid(struct obj* otmp)

View File

@@ -20,6 +20,8 @@ mon_in_room(struct monst* mon, int rmtyp)
return FALSE;
}
DISABLE_WARNING_FORMAT_NONLITERAL
void
dosounds(void)
{
@@ -285,6 +287,8 @@ dosounds(void)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
static const char *const h_sounds[] = {
"beep", "boing", "sing", "belche", "creak", "cough",
"rattle", "ululate", "pop", "jingle", "sniffle", "tinkle",

View File

@@ -242,6 +242,8 @@ vomiting_dialogue(void)
exercise(A_CON, FALSE);
}
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after slime_dialogue */
static NEARDATA const char *const choke_texts[] = {
"You find it hard to breathe.",
"You're gasping for air.",
@@ -407,6 +409,8 @@ slime_dialogue(void)
exercise(A_DEX, FALSE);
}
RESTORE_WARNING_FORMAT_NONLITERAL
void
burn_away_slime(void)
{

View File

@@ -721,6 +721,8 @@ hmon(struct monst *mon,
return result;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* guts of hmon() */
static boolean
hmon_hitmon(struct monst *mon,
@@ -1484,6 +1486,8 @@ shade_aware(struct obj *obj)
return FALSE;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* used for hero vs monster and monster vs monster; also handles
monster vs hero but that won't happen because hero can't be a shade */
boolean
@@ -5265,6 +5269,8 @@ passive_obj(struct monst *mon,
update_inventory();
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* Note: caller must ascertain mtmp is mimicking... */
void
stumble_onto_mimic(struct monst *mtmp)
@@ -5308,6 +5314,8 @@ stumble_onto_mimic(struct monst *mtmp)
map_invisible(mtmp->mx, mtmp->my);
}
RESTORE_WARNING_FORMAT_NONLITERAL
static void
nohandglow(struct monst *mon)
{

View File

@@ -994,6 +994,8 @@ decal_packed(const struct TileImage *gp, unsigned special)
}
#endif
DISABLE_WARNING_FORMAT_NONLITERAL
/*
* Open tile files,
* initialize the SCREEN, switch it to graphics mode,
@@ -1046,7 +1048,7 @@ vesa_Init(void)
vesa_mode = 0xFFFF; /* might want an 8 bit mode after loading tiles */
vesa_detect();
if (vesa_mode == 0xFFFF) {
raw_printf("Reverting to TTY mode, no VESA mode available.",
raw_printf("%s (%d)", "Reverting to TTY mode, no VESA mode available.",
tilefailure);
wait_synch();
iflags.usevga = 0;
@@ -1163,6 +1165,8 @@ vesa_Init(void)
free_tiles();
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* Set the size of the map viewport */
static void
vesa_SetViewPort(void)

View File

@@ -47,7 +47,6 @@ CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
CFLAGS+=-pedantic
CFLAGS+=-Wmissing-declarations
CFLAGS+=-Wno-format-nonliteral
CFLAGS+=-Wunreachable-code
#
# the following are not allowed in C++
@@ -63,7 +62,6 @@ CCXXFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
CCXXFLAGS+=-pedantic
CCXXFLAGS+=-Wmissing-declarations
CCXXFLAGS+=-Wno-format-nonliteral
ifeq "$(CCISCLANG)" ""
# gcc-specific follows

View File

@@ -1625,6 +1625,8 @@ free_window_info(struct WinDesc *cw, boolean free_data)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL
void
tty_clear_nhwindow(winid window)
{
@@ -1680,6 +1682,8 @@ tty_clear_nhwindow(winid window)
cw->curx = cw->cury = 0;
}
RESTORE_WARNING_FORMAT_NONLITERAL
static boolean
toggle_menu_curr(winid window, tty_menu_item *curr, int lineno,
boolean in_view, boolean counting, long count)
@@ -2307,6 +2311,8 @@ process_text_window(winid window, struct WinDesc *cw)
}
}
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE after tty_select_menu */
/*ARGSUSED*/
void
tty_display_nhwindow(
@@ -3149,6 +3155,8 @@ tty_select_menu(winid window, int how, menu_item **menu_list)
return n;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* special hack for treating top line --More-- as a one item menu */
char
tty_message_menu(char let, int how, const char *mesg)