From 38e1a66f24f5bb34b1658d85dda8271c24aab394 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 28 Nov 2008 10:21:43 +0000 Subject: [PATCH] more gcc compatibility flags [r24101] --- TODO | 1 + main.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/TODO b/TODO index 1681588..c674838 100644 --- a/TODO +++ b/TODO @@ -36,3 +36,4 @@ Missing Warnings: main/driver: - delete output file if we had an error +- go through gcc manual and emulate all the gcc flags... diff --git a/main.c b/main.c index 023d26f..d077fb6 100644 --- a/main.c +++ b/main.c @@ -269,6 +269,7 @@ static void add_flag(struct obstack *obst, const char *format, ...) case ')': case '<': case '>': + case '&': obstack_1grow(obst, '\\'); /* FALLTHROUGH */ default: @@ -298,6 +299,9 @@ static FILE *preprocess(const char *fname) add_flag(&cppflags_obst, "-U__SIZE_TYPE__"); add_flag(&cppflags_obst, "-D__SIZE_TYPE__=%s", type_to_string(type_size_t)); + /* hack... */ + add_flag(&cppflags_obst, "-D__builtin_memcpy=memcpy"); + /* handle dependency generation */ if (dep_target[0] != '\0') { add_flag(&cppflags_obst, "-MF"); @@ -788,6 +792,20 @@ int main(int argc, char **argv) GET_ARG_AFTER(opt, "-MT"); add_flag(&cppflags_obst, "-%s", option); add_flag(&cppflags_obst, "%s", opt); + } else if (streq(option, "include")) { + const char *opt; + GET_ARG_AFTER(opt, "-include"); + add_flag(&cppflags_obst, "-include"); + add_flag(&cppflags_obst, "%s", opt); + } else if (streq(option, "isystem")) { + const char *opt; + GET_ARG_AFTER(opt, "-isystem"); + add_flag(&cppflags_obst, "-isystem"); + add_flag(&cppflags_obst, "%s", opt); + } else if (streq(option, "nostdinc") + || streq(option, "trigraphs")) { + /* pass these through to the preprocessor */ + add_flag(&cppflags_obst, "%s", arg); } else if (streq(option, "pipe")) { /* here for gcc compatibility */ } else if (option[0] == 'f') { @@ -798,6 +816,8 @@ int main(int argc, char **argv) strstart(orig_opt, "align-jumps=") || strstart(orig_opt, "align-functions=")) { fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt); + } else if (streq(orig_opt, "verbose-asm")) { + /* ignore: we always print verbose assembler */ } else { char const *opt = orig_opt; bool truth_value = true; @@ -865,6 +885,9 @@ int main(int argc, char **argv) const char *opt; GET_ARG_AFTER(opt, "-Wl,"); add_flag(&ldflags_obst, "-Wl,%s", opt); + } else if (streq(option + 1, "no-trigraphs") + || streq(option + 1, "undef")) { + add_flag(&cppflags_obst, "%s", arg); } else { set_warning_opt(&option[1]); } -- 2.20.1