static struct obstack asflags_obst;
static char dep_target[1024];
static const char *outname;
+static bool define_intmax_types;
typedef enum lang_standard_t {
STANDARD_DEFAULT, /* gnu99 (for C, GCC does gnu89) or gnu++98 (for C++) */
add_flag(&cppflags_obst, "-U__VERSION__");
add_flag(&cppflags_obst, "-D__VERSION__=\"%s\"", cparser_REVISION);
+ if (define_intmax_types) {
+ add_flag(&cppflags_obst, "-U__INTMAX_TYPE__");
+ add_flag(&cppflags_obst, "-D__INTMAX_TYPE__=%s", type_to_string(type_intmax_t));
+ add_flag(&cppflags_obst, "-U__UINTMAX_TYPE__");
+ add_flag(&cppflags_obst, "-D__UINTMAX_TYPE__=%s", type_to_string(type_uintmax_t));
+ }
+
if (flags[0] != '\0') {
size_t len = strlen(flags);
obstack_1grow(&cppflags_obst, ' ');
wchar_atomic_kind = ATOMIC_TYPE_INT;
force_long_double_size = 0;
enable_main_collect2_hack = false;
+ define_intmax_types = false;
if (strstr(os, "linux") != NULL || strstr(os, "bsd") != NULL
|| streq(os, "solaris")) {
} else if (streq(os, "darwin")) {
force_long_double_size = 16;
set_create_ld_ident(create_name_macho);
+ define_intmax_types = true;
} else if (strstr(os, "mingw") != NULL || streq(os, "win32")) {
wchar_atomic_kind = ATOMIC_TYPE_USHORT;
enable_main_collect2_hack = true;
file_list_entry_t *last_file = NULL;
bool construct_dep_target = false;
bool do_timing = false;
+ bool profile_generate = false;
+ bool profile_use = false;
struct obstack file_obst;
atexit(free_temp_files);
if (strstart(orig_opt, "input-charset=")) {
char const* const encoding = strchr(orig_opt, '=') + 1;
select_input_encoding(encoding);
- } else if (streq(orig_opt, "verbose-asm")) {
- /* ignore: we always print verbose assembler */
+ } else if (strstart(orig_opt, "align-loops=") ||
+ strstart(orig_opt, "align-jumps=") ||
+ strstart(orig_opt, "align-functions=")) {
+ fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt);
+ } else if (strstart(orig_opt, "message-length=")) {
+ /* ignore: would only affect error message format */
} else {
+ /* -f options which have an -fno- variant */
char const *opt = orig_opt;
bool truth_value = true;
if (opt[0] == 'n' && opt[1] == 'o' && opt[2] == '-') {
} else if (streq(opt, "unsigned-char")) {
char_is_signed = !truth_value;
} else if (streq(opt, "freestanding")) {
- freestanding = true;
+ freestanding = truth_value;
} else if (streq(opt, "hosted")) {
- freestanding = false;
- } else if (truth_value == false &&
+ freestanding = !truth_value;
+ } else if (streq(opt, "profile-generate")) {
+ profile_generate = truth_value;
+ } else if (streq(opt, "profile-use")) {
+ profile_use = truth_value;
+ } else if (!truth_value &&
streq(opt, "asynchronous-unwind-tables")) {
/* nothing todo, a gcc feature which we don't support
* anyway was deactivated */
- } else if (strstart(orig_opt, "align-loops=") ||
- strstart(orig_opt, "align-jumps=") ||
- strstart(orig_opt, "align-functions=")) {
- fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt);
- } else if (strstart(orig_opt, "message-length=")) {
- /* ignore: would only affect error message format */
+ } else if (streq(orig_opt, "verbose-asm")) {
+ /* ignore: we always print verbose assembler */
} else if (streq(opt, "fast-math") ||
streq(opt, "jump-tables") ||
streq(opt, "expensive-optimizations") ||
} else if (streq(option, "pedantic") ||
streq(option, "ansi")) {
fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg);
- } else if (streq(option, "shared")) {
- add_flag(&ldflags_obst, "-shared");
} else if (strstart(option, "std=")) {
const char *const o = &option[4];
standard =
return EXIT_FAILURE;
}
- /* set the c_mode here, types depends on it */
+ /* apply some effects from switches */
c_mode |= features_on;
c_mode &= ~features_off;
+ if (profile_generate) {
+ add_flag(&ldflags_obst, "-lfirmprof");
+ set_be_option("profilegenerate");
+ }
+ if (profile_use) {
+ set_be_option("profileuse");
+ }
gen_firm_init();
byte_order_big_endian = be_get_backend_param()->byte_order_big_endian;