X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=opts.c;h=0c8d3f4c2de1bc7b561777e12fa35484b00441a6;hp=44919b885e3ec806786a276ffe3524ba445c36de;hb=1d05cd28ee07c9b7b71fe3399fd8acf1977eb506;hpb=ec4cd0d25825dae640904254bacbc3b1e5366c72 diff --git a/opts.c b/opts.c index 44919b8..0c8d3f4 100644 --- a/opts.c +++ b/opts.c @@ -27,7 +27,8 @@ opts_cmd_t opts; /* command lien options */ static void opts_setdefault() { memset(&opts, 0, sizeof(opts_cmd_t)); - + opts.correction = true; + /* warnings */ opts_set(opts.warn, WARN_UNUSED_VARIABLE, true); opts_set(opts.warn, WARN_USED_UNINITIALIZED, true); @@ -65,12 +66,35 @@ static void opts_setdefault() { opts_set(opts.flags, FTEPP_PREDEFS, false); opts_set(opts.flags, CORRECT_TERNARY, true); opts_set(opts.flags, BAIL_ON_WERROR, true); - opts_set(opts.flags, ENHANCED_DIAGNOSTICS, false); +} + +void opts_backup_non_Wall() { + size_t i; + for (i = 0; i <= WARN_DEBUG; ++i) + opts_set(opts.warn_backup, i, OPTS_WARN(i)); +} + +void opts_restore_non_Wall() { + size_t i; + for (i = 0; i <= WARN_DEBUG; ++i) + opts_set(opts.warn, i, OPTS_GENERIC(opts.warn_backup, i)); +} + +void opts_backup_non_Werror_all() { + size_t i; + for (i = 0; i <= WARN_DEBUG; ++i) + opts_set(opts.werror_backup, i, OPTS_WERROR(i)); +} + +void opts_restore_non_Werror_all() { + size_t i; + for (i = 0; i <= WARN_DEBUG; ++i) + opts_set(opts.werror, i, OPTS_GENERIC(opts.werror_backup, i)); } void opts_init(const char *output, int standard, size_t arraysize) { opts_setdefault(); - + opts.output = output; opts.standard = (opts_std_t)standard; /* C++ ... y u no like me? */ opts.max_array_size = arraysize; @@ -276,6 +300,15 @@ static char *opts_ini_load(const char *section, const char *name, const char *va } #include "opts.def" + /* Werror-individuals */ + #define GMQCC_TYPE_WARNS + #define GMQCC_DEFINE_FLAG(X) \ + if (!strcmp(section, "errors") && !strcmp(name, #X)) { \ + opts_set(opts.werror, WARN_##X, opts_ini_bool(value)); \ + found = true; \ + } + #include "opts.def" + /* optimizations */ #define GMQCC_TYPE_OPTIMIZATIONS #define GMQCC_DEFINE_FLAG(X,Y) \