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

@@ -551,6 +551,8 @@ doextlist(void)
#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
#define MAX_EXT_CMD 200 /* Change if we ever have more ext cmds */
DISABLE_WARNING_FORMAT_NONLITERAL
/*
* This is currently used only by the tty interface and is
* controlled via runtime option 'extmenu'. (Most other interfaces
@@ -692,6 +694,9 @@ extcmd_via_menu(void)
}
return ret;
}
RESTORE_WARNING_FORMAT_NONLITERAL
#endif /* TTY_GRAPHICS */
/* #monster command - use special monster ability while polymorphed */
@@ -1457,6 +1462,8 @@ levltyp_to_name(int typ)
return NULL;
}
DISABLE_WARNING_FORMAT_NONLITERAL
/* explanation of base-36 output from wiz_map_levltyp() */
static void
wiz_levltyp_legend(void)
@@ -1497,6 +1504,8 @@ wiz_levltyp_legend(void)
return;
}
RESTORE_WARNING_FORMAT_NONLITERAL
DISABLE_WARNING_CONDEXPR_IS_CONSTANT
/* #wizsmell command - test usmellmon(). */
@@ -1541,6 +1550,8 @@ wiz_smell(void)
RESTORE_WARNING_CONDEXPR_IS_CONSTANT
DISABLE_WARNING_FORMAT_NONLITERAL
#define DEFAULT_TIMEOUT_INCR 30
/* #wizinstrinsic command to set some intrinsics for testing */
@@ -1695,6 +1706,8 @@ wiz_intrinsic(void)
return 0;
}
RESTORE_WARNING_FORMAT_NONLITERAL
/* #wizrumorcheck command - verify each rumor access */
static int
wiz_rumor_check(void)
@@ -2589,6 +2602,8 @@ count_obj(struct obj *chain, long *total_count, long *total_size,
*total_size += size;
}
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE_WARNING follows show_wiz_stats */
static void
obj_chain(winid win, const char *src, struct obj *chain, boolean force,
long *total_count, long *total_size)
@@ -2905,6 +2920,8 @@ wiz_show_stats(void)
return 0;
}
RESTORE_WARNING_FORMAT_NONLITERAL
void
sanity_check(void)
{