void opts_init (const char *, int, size_t);
void opts_set (uint32_t *, size_t, bool);
void opts_setoptimlevel(unsigned int);
+void opts_ini_init (const char *);
enum {
# define GMQCC_TYPE_FLAGS
char buffer[1024];
char *redirout = (char*)stdout;
char *redirerr = (char*)stderr;
+ char *config = NULL;
while (!argend && argc > 1) {
char *argarg;
con_change(redirout, redirerr);
continue;
}
+ if (options_long_gcc("config", &argc, &argv, &argarg)) {
+ config = argarg;
+ continue;
+ }
/* show defaults (like pathscale) */
if (!strcmp(argv[0]+1, "show-defaults")) {
vec_push(items, item);
}
}
+ opts_ini_init(config);
return true;
}
unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
opts_cmd_t opts; /* command lien options */
-static void opts_ini_init();
static void opts_setdefault() {
memset(&opts, 0, sizeof(opts_cmd_t));
opts.output = output;
opts.standard = standard;
opts.max_array_size = arraysize;
-
- opts_ini_init();
}
static bool opts_setflag_all(const char *name, bool on, uint32_t *flags, const opts_flag_def *list, size_t listsize) {
* Actual loading subsystem, this finds the ini or cfg file, and properly
* loads it and executes it to set compiler options.
*/
-static void opts_ini_init() {
+void opts_ini_init(const char *file) {
/*
* Possible matches are:
* gmqcc.ini
* gmqcc.cfg
*/
+ char *error;
+ size_t line;
+ FILE *ini;
- char *file;
- char *error;
- size_t line;
- FILE *ini;
-
- /* try ini */
- if (!(ini = fopen((file = "gmqcc.ini"), "r")))
- /* try cfg */
- if (!(ini = fopen((file = "gmqcc.cfg"), "r")))
- return;
+
+ if (!file) {
+ /* try ini */
+ if (!(ini = fopen((file = "gmqcc.ini"), "r")))
+ /* try cfg */
+ if (!(ini = fopen((file = "gmqcc.cfg"), "r")))
+ return;
+ } else if (!(ini = fopen(file, "r")))
+ return;
con_out("found ini file `%s`\n", file);