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);
| ^~~~~~~~~~~
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
return FALSE;
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* getobj callback for object to be invoked */
static int
invoke_ok(struct obj *obj)
return TRUE;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/*
* drop_ball()
*
}
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* ball&chain cause hero to randomly lose stuff from inventory */
static void
litter(void)
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/*
* Called from dighole(), but also from do_break_wand()
* in apply.c.
}
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* return TRUE if digging succeeded, FALSE otherwise */
boolean
dighole(boolean pit_only, boolean by_magic, coord *cc)
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
You(umsg, what);
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* Fountain of snakes! */
static void
dowatersnakes(void)
}
}
+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.
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)
return otmp;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
void
silly_thing(const char *word,
#ifdef OBSOLETE_HANDLING
pline(silly_thing_to, word);
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static int
ckvalidcat(struct obj *otmp)
{
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
return PICKLOCK_DID_SOMETHING;
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* the #force command - try to force a chest with your weapon */
int
doforce(void)
mdamageu(mtmp, dmg);
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
static void
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)
{
#define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5)
+DISABLE_WARNING_FORMAT_NONLITERAL
+
void
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)
return obj_state_names[where];
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
static void
insane_object(
struct obj *obj,
}
}
+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
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)
pline(msg, Monnam(mtmp));
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
void
mpickgold(register struct monst* mtmp)
{
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
void
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(
return FALSE;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
boolean
mon_reflects(struct monst* mon, 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)
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* make a (new) human out of the player */
static void
polyman(const char *fmt, const char *arg)
see_monsters();
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
void
change_sex(void)
{
learn_unseen_invent();
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
boolean
make_hallucinated(
long xtime, /* nonzero if this is an attempt to turn on hallucination */
return changed;
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
void
make_deaf(long xtime, boolean talk)
{
(boolean) !Blind);
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
static void
peffect_gain_level(struct obj *otmp)
{
u.uexp = rndexp(TRUE);
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static void
peffect_healing(struct obj *otmp)
{
return (struct monst *) 0;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* called from check_special_room() when the player enters the temple room */
void
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
return GETOBJ_DOWNPLAY;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* the #read command; read a scroll or spell book or various other things */
int
doread(void)
return ECMD_TIME;
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static void
stripspe(register struct obj* obj)
{
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* shopkeeper tells you what you bought or sold, sometimes partly IDing it */
static void
shk_names_obj(
}
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* decide whether a shopkeeper thinks an item belongs to her */
boolean
billable(
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.'",
}
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static void
kops_gone(boolean silent)
{
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
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)
return FALSE;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
void
dosounds(void)
{
}
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static const char *const h_sounds[] = {
"beep", "boing", "sing", "belche", "creak", "cough",
"rattle", "ululate", "pop", "jingle", "sniffle", "tinkle",
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.",
exercise(A_DEX, FALSE);
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
void
burn_away_slime(void)
{
return result;
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* guts of hmon() */
static boolean
hmon_hitmon(struct monst *mon,
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
update_inventory();
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/* Note: caller must ascertain mtmp is mimicking... */
void
stumble_onto_mimic(struct monst *mtmp)
map_invisible(mtmp->mx, mtmp->my);
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
static void
nohandglow(struct monst *mon)
{
}
#endif
+DISABLE_WARNING_FORMAT_NONLITERAL
+
/*
* Open tile files,
* initialize the SCREEN, switch it to graphics mode,
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;
free_tiles();
}
+RESTORE_WARNING_FORMAT_NONLITERAL
+
/* Set the size of the map viewport */
static void
vesa_SetViewPort(void)
-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++
-Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
CCXXFLAGS+=-pedantic
CCXXFLAGS+=-Wmissing-declarations
-CCXXFLAGS+=-Wno-format-nonliteral
ifeq "$(CCISCLANG)" ""
# gcc-specific follows
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL
+
void
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)
}
}
+DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE after tty_select_menu */
+
/*ARGSUSED*/
void
tty_display_nhwindow(
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)