#include "warning.h"
#ifndef PREPROCESSOR
-#define PREPROCESSOR "cpp -std=c99 -U__WCHAR_TYPE__ -D__WCHAR_TYPE__=int -U__SIZE_TYPE__ -D__SIZE_TYPE__=__SIZE_TYPE__ -m32"
+#define PREPROCESSOR "cpp -std=c99 -U__WCHAR_TYPE__ -D__WCHAR_TYPE__=int -U__SIZE_TYPE__ -D__SIZE_TYPE__=__SIZE_TYPE__ -m32 -U__STRICT_ANSI__"
#endif
#ifndef LINKER
|| strcmp(opt, "unroll-loops") == 0
|| strcmp(opt, "expensive-optimizations") == 0
|| strcmp(opt, "no-common") == 0
+ || strcmp(opt, "PIC") == 0
|| strncmp(opt, "align-loops=", sizeof("align-loops=")-1) == 0
|| strncmp(opt, "align-jumps=", sizeof("align-jumps=")-1) == 0
|| strncmp(opt, "align-functions=", sizeof("align-functions=")-1) == 0) {
strncpy(cpu_arch, opt, sizeof(cpu_arch));
}
} else if(option[0] == 'W') {
- set_warning_opt(&option[1]);
+ if(strncmp(option + 1, "l,", 2) == 0) // a gcc-style linker option
+ {
+ const char *opt;
+ GET_ARG_AFTER(opt, "-Wl,");
+ add_flag(&ldflags_obst, "-Wl,%s", opt);
+ }
+ else set_warning_opt(&option[1]);
} else if(option[0] == 'm') {
/* -m options */
const char *opt;
} else if(strcmp(option, "pg") == 0) {
set_be_option("gprof");
add_flag(&ldflags_obst, "-pg");
- } else if(strcmp(option, "pedantic") == 0) {
+ } else if(strcmp(option, "pedantic") == 0
+ || strcmp(option, "ansi") == 0) {
fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg);
} else if(strcmp(option, "shared") == 0) {
add_flag(&ldflags_obst, "-shared");
case 'h': type = FILETYPE_C; break;
case 's': type = FILETYPE_PREPROCESSED_ASSEMBLER; break;
case 'S': type = FILETYPE_ASSEMBLER; break;
+
+ case 'a':
case 'o': type = FILETYPE_OBJECT; break;
}
+ } else if (len > 3 && arg[len-3] == '.') {
+ if(strcmp(arg + len - 2, "so") == 0) {
+ type = FILETYPE_OBJECT;
+ }
}
if (type == FILETYPE_AUTODETECT) {
if (in == preprocessed_in) {
int pp_result = pclose(preprocessed_in);
if (pp_result != EXIT_SUCCESS) {
- return pp_result;
+ exit(EXIT_FAILURE);
}
}
return pp_result;
}
}
+ if(asm_out != out) {
+ fclose(asm_out);
+ }
}
if (mode == Compile)
file->type = filetype;
}
+ if (result != EXIT_SUCCESS)
+ return result;
+
/* link program file */
if(mode == CompileAssembleLink) {
obstack_1grow(&ldflags_obst, '\0');