X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=opts.c;h=548381a3be634385b989803c63d8e46e0d2ca4fd;hb=51346734616d07f975ce187a77f278dd7500c0a3;hp=43c4563454866d574f58bf2b9b35cd743ed73f0b;hpb=e8cd9411b0b03659a14f64225915ec23b696a81d;p=xonotic%2Fgmqcc.git diff --git a/opts.c b/opts.c index 43c4563..548381a 100644 --- a/opts.c +++ b/opts.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 + * Copyright (C) 2012, 2013 * Wolfgang Bumiller * Dale Weiler * @@ -35,7 +35,7 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_EXTENSIONS, true); opts_set(opts.warn, WARN_FIELD_REDECLARED, true); opts_set(opts.warn, WARN_MISSING_RETURN_VALUES, true); - opts_set(opts.warn, WARN_TOO_FEW_PARAMETERS, 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); @@ -54,17 +54,25 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_UNREACHABLE_CODE, true); opts_set(opts.warn, WARN_CPP, true); 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, ENHANCED_DIAGNOSTICS, true); } void opts_init(const char *output, int standard, size_t arraysize) { opts_setdefault(); opts.output = output; - opts.standard = standard; + opts.standard = (opts_std_t)standard; /* C++ ... y u no like me? */ opts.max_array_size = arraysize; } @@ -74,7 +82,7 @@ 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 0 +#if 1 if (on) flags[lb.idx] |= (1<<(lb.bit)); else @@ -104,8 +112,9 @@ bool opts_setoptim (const char *name, bool on) { } void opts_set(uint32_t *flags, size_t idx, bool on) { - longbit lb = LONGBIT(idx); -#if 0 + longbit lb; + LONGBIT_SET(lb, idx); +#if 1 if (on) flags[lb.idx] |= (1<<(lb.bit)); else @@ -170,7 +179,7 @@ static size_t opts_ini_parse ( char *read_name; char *read_value; - while (util_getline(&line, &linesize, filehandle) != EOF) { + while (file_getline(&line, &linesize, filehandle) != EOF) { parse_beg = line; /* handle BOM */ @@ -316,11 +325,11 @@ void opts_ini_init(const char *file) { if (!file) { /* try ini */ - if (!(ini = fopen((file = "gmqcc.ini"), "r"))) + if (!(ini = file_open((file = "gmqcc.ini"), "r"))) /* try cfg */ - if (!(ini = fopen((file = "gmqcc.cfg"), "r"))) + if (!(ini = file_open((file = "gmqcc.cfg"), "r"))) return; - } else if (!(ini = fopen(file, "r"))) + } else if (!(ini = file_open(file, "r"))) return; con_out("found ini file `%s`\n", file); @@ -331,5 +340,5 @@ void opts_ini_init(const char *file) { vec_free(error); } - fclose(ini); + file_close(ini); }