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:
@@ -12,8 +12,11 @@
|
||||
* When STDC_Pragma_AVAILABLE is not defined, these are defined as no-ops:
|
||||
* DISABLE_WARNING_UNREACHABLE_CODE
|
||||
* DISABLE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
* DISABLE_WARNING_FORMAT_NONLITERAL
|
||||
* ...
|
||||
* RESTORE_WARNINGS
|
||||
* RESTORE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
* RESTORE_WARNING_FORMAT_NONLITERAL
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -34,8 +37,12 @@
|
||||
#define DISABLE_WARNING_UNREACHABLE_CODE \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wunreachable-code\"")
|
||||
#define DISABLE_WARNING_FORMAT_NONLITERAL \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"")
|
||||
#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("clang diagnostic pop")
|
||||
#define RESTORE_WARNINGS _Pragma("clang diagnostic pop")
|
||||
#define STDC_Pragma_AVAILABLE
|
||||
|
||||
@@ -44,8 +51,12 @@
|
||||
#define DISABLE_WARNING_UNREACHABLE_CODE \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunreachable-code\"")
|
||||
#define DISABLE_WARNING_FORMAT_NONLITERAL \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
|
||||
#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("GCC diagnostic pop")
|
||||
#define RESTORE_WARNINGS _Pragma("GCC diagnostic pop")
|
||||
#define STDC_Pragma_AVAILABLE
|
||||
|
||||
@@ -53,10 +64,14 @@
|
||||
#define DISABLE_WARNING_UNREACHABLE_CODE \
|
||||
_Pragma("warning( push )") \
|
||||
_Pragma("warning( disable : 4702 )")
|
||||
#define DISABLE_WARNING_FORMAT_NONLITERAL \
|
||||
_Pragma("warning( push )") \
|
||||
_Pragma("warning( disable : 4774 )")
|
||||
#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT \
|
||||
_Pragma("warning( push )") \
|
||||
_Pragma("warning( disable : 4127 )")
|
||||
#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT _Pragma("warning( pop )")
|
||||
#define RESTORE_WARNING_FORMAT_NONLITERAL _Pragma("warning( pop )")
|
||||
#define RESTORE_WARNINGS _Pragma("warning( pop )")
|
||||
#define STDC_Pragma_AVAILABLE
|
||||
|
||||
@@ -70,8 +85,10 @@
|
||||
|
||||
#if !defined(STDC_Pragma_AVAILABLE)
|
||||
#define DISABLE_WARNING_UNREACHABLE_CODE
|
||||
#define DISABLE_WARNING_FORMAT_NONLITERAL
|
||||
#define DISABLE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT
|
||||
#define RESTORE_WARNING_FORMAT_NONLITERAL
|
||||
#define RESTORE_WARNINGS
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user