X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=opts.c;h=5ea4f6e85ff2654cdfab6834d69bfcd4eff390e8;hp=f0dc3260b949d03c68db312361849c72805fa498;hb=d201cfe6b49f95ba8bcaa0eebb3a6fb7e1a16913;hpb=6c4c37308969b6277534d6d6e57d5eb3fe791d63 diff --git a/opts.c b/opts.c index f0dc326..5ea4f6e 100644 --- a/opts.c +++ b/opts.c @@ -27,7 +27,7 @@ opts_cmd_t opts; /* command lien options */ static void opts_setdefault() { memset(&opts, 0, sizeof(opts_cmd_t)); - opts.correction = true; + OPTION_VALUE_BOOL(OPTION_CORRECTION) = true; /* warnings */ opts_set(opts.warn, WARN_UNUSED_VARIABLE, true); @@ -37,7 +37,6 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_FIELD_REDECLARED, true); opts_set(opts.warn, WARN_MISSING_RETURN_VALUES, true); opts_set(opts.warn, WARN_INVALID_PARAMETER_COUNT, true); - opts_set(opts.warn, WARN_LOCAL_SHADOWS, false); opts_set(opts.warn, WARN_LOCAL_CONSTANTS, true); opts_set(opts.warn, WARN_VOID_VARIABLES, true); opts_set(opts.warn, WARN_IMPLICIT_FUNCTION_POINTER, true); @@ -56,13 +55,11 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_UNKNOWN_ATTRIBUTE, true); opts_set(opts.warn, WARN_RESERVED_NAMES, true); opts_set(opts.warn, WARN_UNINITIALIZED_CONSTANT, true); - opts_set(opts.warn, WARN_UNINITIALIZED_GLOBAL, false); opts_set(opts.warn, WARN_DEPRECATED, true); opts_set(opts.warn, WARN_PARENTHESIS, true); + /* flags */ opts_set(opts.flags, ADJUST_VECTOR_FIELDS, true); - opts_set(opts.flags, FTEPP, false); - 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, LEGACY_VECTOR_MATHS, true); @@ -95,9 +92,9 @@ void opts_restore_non_Werror_all() { 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; + OPTION_VALUE_STR(OPTION_OUTPUT) = (char*)output; + OPTION_VALUE_U32(OPTION_STANDARD) = standard; + OPTION_VALUE_U32(OPTION_MAX_ARRAY_SIZE) = arraysize; } static bool opts_setflag_all(const char *name, bool on, uint32_t *flags, const opts_flag_def *list, size_t listsize) { @@ -106,17 +103,12 @@ static bool opts_setflag_all(const char *name, bool on, uint32_t *flags, const o for (i = 0; i < listsize; ++i) { if (!strcmp(name, list[i].name)) { longbit lb = list[i].bit; -#if 1 + if (on) flags[lb.idx] |= (1<<(lb.bit)); else flags[lb.idx] &= ~(1<<(lb.bit)); -#else - if (on) - flags[0] |= (1<