size_t i;
for (i = 0; i < COUNT_OPTIMIZATIONS; ++i)
opts_set(opts.optimization, i, level >= opts_opt_oflag[i]);
+
+ if (!level)
+ opts.optimizeoff = true;
}
/*
char *read_name;
char *read_value;
- while (file_getline(&line, &linesize, filehandle) != EOF) {
+ while (fs_file_getline(&line, &linesize, filehandle) != EOF) {
parse_beg = line;
/* handle BOM */
static bool opts_ini_bool(const char *value) {
if (!strcmp(value, "true")) return true;
if (!strcmp(value, "false")) return false;
- return !!atoi(value);
+ return !!strtol(value, NULL, 10);
}
static char *opts_ini_load(const char *section, const char *name, const char *value) {
/* flags */
#define GMQCC_TYPE_FLAGS
- #define GMQCC_DEFINE_FLAG(X, Y) \
+ #define GMQCC_DEFINE_FLAG(X) \
if (!strcmp(section, "flags") && !strcmp(name, #X)) { \
opts_set(opts.flags, X, opts_ini_bool(value)); \
found = true; \
/* warnings */
#define GMQCC_TYPE_WARNS
- #define GMQCC_DEFINE_FLAG(X, Y) \
+ #define GMQCC_DEFINE_FLAG(X) \
if (!strcmp(section, "warnings") && !strcmp(name, #X)) { \
opts_set(opts.warn, WARN_##X, opts_ini_bool(value)); \
found = true; \
/* Werror-individuals */
#define GMQCC_TYPE_WARNS
- #define GMQCC_DEFINE_FLAG(X, Y) \
+ #define GMQCC_DEFINE_FLAG(X) \
if (!strcmp(section, "errors") && !strcmp(name, #X)) { \
opts_set(opts.werror, WARN_##X, opts_ini_bool(value)); \
found = true; \
/* optimizations */
#define GMQCC_TYPE_OPTIMIZATIONS
- #define GMQCC_DEFINE_FLAG(X,Y,Z) \
+ #define GMQCC_DEFINE_FLAG(X,Y) \
if (!strcmp(section, "optimizations") && !strcmp(name, #X)) { \
opts_set(opts.optimization, OPTIM_##X, opts_ini_bool(value)); \
found = true; \
if (!file) {
/* try ini */
- if (!(ini = file_open((file = "gmqcc.ini"), "r")))
+ if (!(ini = fs_file_open((file = "gmqcc.ini"), "r")))
/* try cfg */
- if (!(ini = file_open((file = "gmqcc.cfg"), "r")))
+ if (!(ini = fs_file_open((file = "gmqcc.cfg"), "r")))
return;
- } else if (!(ini = file_open(file, "r")))
+ } else if (!(ini = fs_file_open(file, "r")))
return;
con_out("found ini file `%s`\n", file);
vec_free(error);
}
- file_close(ini);
+ fs_file_close(ini);
}