enable -Wformat-nonliteral for linux and equivalent for windows compilers

Whitelist all the verified existing triggers:
makedefs.c: In function ‘name_file’
attrib.c: one compiler balks at a ? b : c for fmtstring
cmd.c: In function ‘extcmd_via_menu’
cmd.c: In function ‘wiz_levltyp_legend’
do.c: In function ‘goto_level’
do_name.c: In function ‘coord_desc’
dungeon.c: In function ‘overview_stats’
eat.c:  one compiler balks at a ? b : c for fmtstring
end.c:  one compiler balks at a ? b : c for fmtstring
engrave.c: In function ‘engr_stats’
hack:c one compiler balks at a ? b : c for fmtstring
hacklib.c: one compiler balks at a ? b : c for fmtstring
insight.c: one compiler balks at a ? b : c for fmtstring
invent.c: In function ‘let_to_name’
light.c: In function ‘light_stats’
mhitm.c: In function ‘missmm’
options.c: In function ‘handler_symset’
options.c: In function ‘basic_menu_colors’
options.c: In function ‘optfn_o_autopickup_exceptions’
options.c: In function ‘optfn_o_menu_colors’
options.c: In function ‘optfn_o_message_types’
options.c: In function ‘optfn_o_status_cond’
options.c: In function ‘optfn_o_status_hilites’
options.c: In function ‘doset’
options.c: In function ‘doset_add_menu’
options.c: In function ‘show_menu_controls’
options.c: In function ‘handle_add_list_remove’
pager.c: In function ‘do_supplemental_info’
pager.c: In function ‘dohelp’
region.c: In function ‘region_stats’
rumors.c: sscanf usage
sounds.c: In function ‘domonnoise’
spell.c: In function ‘dospellmenu’
timeout.c: In function ‘timer_stats’
topten.c: In function ‘outentry’, fscanf, sscanf, fprintf usage
windows.c: In function ‘genl_status_update’
zap.c: one compiler balks at a ? b : c for fmtstring
win/curses/cursstat.c: In function ‘curses_status_update’
win/tty/wintty.c: In function ‘tty_status_update’
win/win32/mswproc.c: In function ‘mswin_status_update’
This commit is contained in:
nhmall
2021-02-02 19:03:12 -05:00
parent d79365c6b0
commit 5b1d668c44
32 changed files with 195 additions and 5 deletions

View File

@@ -4849,6 +4849,8 @@ handler_whatis_filter(void)
return optn_ok;
}
DISABLE_WARNING_FORMAT_NONLITERAL
static int
handler_symset(int optidx)
{
@@ -5026,6 +5028,8 @@ handler_symset(int optidx)
return optidx;
}
RESTORE_WARNING_FORMAT_NONLITERAL
static int
handler_autopickup_exception(void)
{
@@ -6150,6 +6154,8 @@ match_str2attr(const char *str, boolean complain)
extern const char regex_id[]; /* from sys/share/<various>regex.{c,cpp} */
DISABLE_WARNING_FORMAT_NONLITERAL
/* True: temporarily replace menu color entries with a fake set of menu
colors, { "light blue"=light_blue, "blue"=blue, "red"=red, &c }, that
illustrates most colors for use when the pick-a-color menu is rendered;
@@ -6203,6 +6209,8 @@ basic_menu_colors(boolean load_colors)
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
int
query_color(const char *prompt)
{
@@ -6970,6 +6978,8 @@ static char fmtstr_doset[] = "%s%-15s [%s] ";
static char fmtstr_doset_tab[] = "%s\t[%s]";
static char n_currently_set[] = "(%d currently set)";
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after show_menucontrols() */
static int
optfn_o_autopickup_exceptions(int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op UNUSED)
@@ -7340,6 +7350,7 @@ doset_add_menu(winid win, /* window to add to */
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
}
/* display keys for menu actions; used by cmd.c '?i' and pager.c '?k' */
void
show_menu_controls(winid win, boolean dolist)
@@ -7431,6 +7442,9 @@ show_menu_controls(winid win, boolean dolist)
arg = "";
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
static int
count_cond(void)
{
@@ -7457,6 +7471,8 @@ count_apes(void)
return numapes;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* common to msg-types, menu-colors, autopickup-exceptions */
static int
handle_add_list_remove(const char *optname, int numtotal)
@@ -7504,6 +7520,8 @@ handle_add_list_remove(const char *optname, int numtotal)
return opt_idx;
}
RESTORE_WARNING_FORMAT_NONLITERAL
int
dotogglepickup(void)
{