From 1157ea28b1e192df7fcc983e77eba70ed605e49f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 1 Oct 2017 17:30:49 +0100 Subject: [PATCH] fcc: add the ability to pass arguments directly to the underlying compiler Please only use this for debug as the goal is to make fcc eventually be a generic front end that hides all the differences! Usage is like gcc fcc -Wc,-sdcc-option --- Library/tools/fcc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Library/tools/fcc.c b/Library/tools/fcc.c index 8882faba..369bece9 100644 --- a/Library/tools/fcc.c +++ b/Library/tools/fcc.c @@ -101,7 +101,6 @@ static void add_library_path(const char *p) libptail->next = a; libptail = a; } - struct arglist *libhead, *libtail; static void add_library(const char *p) @@ -126,6 +125,18 @@ static void add_include_path(const char *p) includetail = a; } +struct arglist *extrahead, *extratail; + +static void add_extra(const char *p) +{ + struct arglist *a = arg_make(p); + if (extrahead == NULL) + extrahead = a; + else + extratail->next = a; + extratail = a; +} + static char *target; static void set_target(const char *p) @@ -421,6 +432,8 @@ static void build_command(void) add_argument("-Ddouble=float"); /* User provided macros */ add_argument_list(machead); + /* -Wc, options */ + add_argument_list(extrahead); /* Paths */ add_option_list("-I", includehead); if (mode == MODE_LINK) @@ -548,6 +561,12 @@ int main(int argc, const char *argv[]) { case 'g': debug = 1; break; + case 'W': /* -Wc,-foo to pass on -foo directly */ + if (p[2] == 'c' && p[3] == ',') { + add_extra(p + 4); + break; + } + /* Fall through */ default: if (strcmp(p, "-Werror") == 0) werror = 1; -- 2.34.1