X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=opts.c;h=334186b8cf9a034764d38c53734026d350631f74;hb=cfa7119fdb3931093db07109d00808cda70aa604;hp=6008fb1dfa55f0307eee6af56f4e3a12a3b94ae0;hpb=f78ab9061b015f94e3925b48e3d856f1afc44880;p=xonotic%2Fgmqcc.git diff --git a/opts.c b/opts.c index 6008fb1..334186b 100644 --- a/opts.c +++ b/opts.c @@ -53,17 +53,20 @@ static void opts_setdefault() { opts_set(opts.warn, WARN_UNKNOWN_PRAGMAS, true); opts_set(opts.warn, WARN_UNREACHABLE_CODE, true); opts_set(opts.warn, WARN_CPP, true); + opts_set(opts.warn, WARN_UNKNOWN_ATTRIBUTE, 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); } 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; } @@ -73,7 +76,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 @@ -103,8 +106,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 @@ -169,7 +173,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 */ @@ -315,11 +319,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); @@ -330,5 +334,5 @@ void opts_ini_init(const char *file) { vec_free(error); } - fclose(ini); + file_close(ini); }