]> granicus.if.org Git - nethack/commitdiff
whitelist several non-literal format strings
authornhmall <nhmall@nethack.org>
Sun, 9 Jan 2022 19:18:10 +0000 (14:18 -0500)
committernhmall <nhmall@nethack.org>
Sun, 9 Jan 2022 19:18:10 +0000 (14:18 -0500)
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);
      |               ^~~~~~~~~~~

22 files changed:
src/artifact.c
src/ball.c
src/dig.c
src/fountain.c
src/invent.c
src/lock.c
src/mcastu.c
src/mhitu.c
src/mkobj.c
src/mon.c
src/muse.c
src/polyself.c
src/potion.c
src/priest.c
src/read.c
src/shk.c
src/sounds.c
src/timeout.c
src/uhitm.c
sys/msdos/vidvesa.c
sys/unix/hints/include/compiler.370
win/tty/wintty.c

index 336d5474ac2b6f503bfdf905f0127d8d6c772647..56433592345f02105757637f082baa30f5a9be24 100644 (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)
index 94428e9cbf599f67f63df5fde27dab39fbfa8b49..ec7fe5917bef8779a8520d612c62bd6e62dc3b41 100644 (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)
index 2c41ff3c6b495ac81f65842d9080b90b3a9959cc..dcd4e3f79880b0171132ef0bce548941cb81bf2c 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -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)
index fad5599d2264a1e1ee9dbbfc4705d9463d0ae4ba..d7e72d81f54d274b351424981cb6c46d2c56e21f 100644 (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)
index d8aeffcb6c5d543daeea96adcbe8d8fa4021f83a..9d59c0082f3ee1d1ac753f9a5e340e50ddada451 100644 (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)
 {
index 4c63a338ad504fde430784d17f9915eb2c147364..21b99bef0d823b42646d4609e5b67920b15177f9 100644 (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)
index 7d5dfaac659f2c4cb6591b99d2c9f49b4d8c77fd..b31572f28bfb6bd06962be333561c4d1005efb5f 100644 (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)
 {
index 0027120489738343ef8d1d55ca81009700924f8c..679652f3e525737726638505c1389b05da021d61 100644 (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)
index abe9f15be73ce2b4ee75d3a9aa563ff5b0b1334b..92e7337979689560db7591c7acb0db19f94c6bd3 100644 (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
index 9e872a9e01906f7f1536aebde40acb8c35ba0987..52c63a74df89cb840f4f94dfa109e70f3a12ed2f 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -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(
index f9026204edc40ddf026e38031a83ec3f84df9a01..47caf63a2392758472c89fabb12f0768e5348422 100644 (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)
index 613106ce3ffa9d6e38977ac84ce505bc62c6ab24..66b56cd2dcce8b9af230eb88013e41806fb43b39 100644 (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)
 {
index 5b8598c7f8e200be03fd9d7d7cdef44d40a98b74..72d69f8abe70721feff68d7ad19f2d6c9a8b2aac 100644 (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)
 {
index 2b97fe130aaf87a0fe51a27eeb33ccd4316af70b..efc121f1441ece20d2a502a6f8b4f8946ae88ae0 100644 (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
index 566b7e8893dabc5c9a2a93a65c69af89d5853f7e..19c0fbb0921a604a1fdf2c939500464ae4b90186 100644 (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)
 {
index 35578c23c6d26dc80a96d266d524eaf5e1598d03..85ff5bb254d91ac8f8610796a06400a7b4341a8d 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -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)
index a1b0b21a89ec5772b9a324d02e5ab3f54012d7a3..aced134ac181cbd4affbdcee6a7167bfc2fd5054 100644 (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",
index 8b473e5ec7975ae664da2128543daa25318a6aec..9258bb075bbb67c74283eb4c65f72faee0813392 100644 (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)
 {
index 63cb1c02b8762881f18306d153c753f69f430061..e383a30c48b6f93f3aa7a0ac2e30735089b86393 100644 (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)
 {
index 6d662bf351b1d76b87fd168d6cd88bc7a80d5a36..83e9831695cab694b892a8d565cba66d2c96ad15 100644 (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)
index d1fc1a3e4fcfb384e7eb3fcc809d0818a9beea2e..533fd521099301fb27747d4266c241071b9fd5d5 100755 (executable)
@@ -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
index c0717c62076e7a9d8e85c16f5473a1d411a9b0f7..e6c353ce93f5f15f5e33736260d293844f63526b 100644 (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)