opts_set(opts.warn, WARN_MULTIBYTE_CHARACTER, true);
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);
+ opts_set(opts.warn, WARN_RESERVED_NAMES, true);
+ opts_set(opts.warn, WARN_UNINITIALIZED_CONSTANT, true);
+ opts_set(opts.warn, WARN_UNINITIALIZED_GLOBAL, false);
/* 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;
}
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
}
return false;
}
-bool opts_setflag (const char *name, bool on) {
+bool opts_setflag (const char *name, bool on) {
return opts_setflag_all(name, on, opts.flags, opts_flag_list, COUNT_FLAGS);
}
-bool opts_setwarn (const char *name, bool on) {
+bool opts_setwarn (const char *name, bool on) {
return opts_setflag_all(name, on, opts.warn, opts_warn_list, COUNT_WARNINGS);
}
-bool opts_setoptim(const char *name, bool on) {
+bool opts_setwerror(const char *name, bool on) {
+ return opts_setflag_all(name, on, opts.werror, opts_warn_list, COUNT_WARNINGS);
+}
+bool opts_setoptim (const char *name, bool on) {
return opts_setflag_all(name, on, opts.optimization, opts_opt_list, COUNT_OPTIMIZATIONS);
}
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
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 */
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);
vec_free(error);
}
- fclose(ini);
+ file_close(ini);
}