diff --git a/src/artifact.c b/src/artifact.c index 336d5474a..564335923 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -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) diff --git a/src/ball.c b/src/ball.c index 94428e9cb..ec7fe5917 100644 --- a/src/ball.c +++ b/src/ball.c @@ -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) diff --git a/src/dig.c b/src/dig.c index 2c41ff3c6..dcd4e3f79 100644 --- 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) diff --git a/src/fountain.c b/src/fountain.c index fad5599d2..d7e72d81f 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -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) diff --git a/src/invent.c b/src/invent.c index d8aeffcb6..9d59c0082 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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) { diff --git a/src/lock.c b/src/lock.c index 4c63a338a..21b99bef0 100644 --- a/src/lock.c +++ b/src/lock.c @@ -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) diff --git a/src/mcastu.c b/src/mcastu.c index 7d5dfaac6..b31572f28 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -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) { diff --git a/src/mhitu.c b/src/mhitu.c index 002712048..679652f3e 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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) diff --git a/src/mkobj.c b/src/mkobj.c index abe9f15be..92e733797 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -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 diff --git a/src/mon.c b/src/mon.c index 9e872a9e0..52c63a74d 100644 --- 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( diff --git a/src/muse.c b/src/muse.c index f9026204e..47caf63a2 100644 --- a/src/muse.c +++ b/src/muse.c @@ -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) diff --git a/src/polyself.c b/src/polyself.c index 613106ce3..66b56cd2d 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -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) { diff --git a/src/potion.c b/src/potion.c index 5b8598c7f..72d69f8ab 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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) { diff --git a/src/priest.c b/src/priest.c index 2b97fe130..efc121f14 100644 --- a/src/priest.c +++ b/src/priest.c @@ -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 diff --git a/src/read.c b/src/read.c index 566b7e889..19c0fbb09 100644 --- a/src/read.c +++ b/src/read.c @@ -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) { diff --git a/src/shk.c b/src/shk.c index 35578c23c..85ff5bb25 100644 --- 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) diff --git a/src/sounds.c b/src/sounds.c index a1b0b21a8..aced134ac 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -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", diff --git a/src/timeout.c b/src/timeout.c index 8b473e5ec..9258bb075 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -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) { diff --git a/src/uhitm.c b/src/uhitm.c index 63cb1c02b..e383a30c4 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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) { diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index 6d662bf35..83e983169 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -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) diff --git a/sys/unix/hints/include/compiler.370 b/sys/unix/hints/include/compiler.370 index d1fc1a3e4..533fd5210 100755 --- a/sys/unix/hints/include/compiler.370 +++ b/sys/unix/hints/include/compiler.370 @@ -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 diff --git a/win/tty/wintty.c b/win/tty/wintty.c index c0717c620..e6c353ce9 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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)