From a046291bc6b5843709af03203b07549c30dd1f32 Mon Sep 17 00:00:00 2001 From: michaelh Date: Mon, 5 Nov 2001 01:52:21 +0000 Subject: [PATCH] * src/SDCCmain.c (parseCmdLine): Added support for -Wp. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1503 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 2 ++ src/SDCCmain.c | 32 ++++++++++++++------------- support/Util/BuildCmd.c | 4 ++-- support/Util/BuildCmd.h | 2 +- support/regression/tests/bug-478094.c | 5 ++++- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0700abec..9d11a0c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2001-11-04 Michael Hope + * src/SDCCmain.c (parseCmdLine): Added support for -Wp. + * support/regression/tests/bug-478094.c: Added. * src/z80/gen.c (commitPair): Fixed silly gbz80/z80 commit to static bug. diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 705e408f..3673b509 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -146,7 +146,7 @@ optionsTable[] = { { 'M', NULL, NULL, "Preprocessor option" }, { 'V', NULL, &verboseExec, "Execute verbosely. Show sub commands as they are run" }, { 'S', NULL, &noAssemble, "Compile only; do not assemble or link" }, - { 'W', NULL, NULL, "Pass through options to the assembler (a) or linker (l)" }, + { 'W', NULL, NULL, "Pass through options to the pre-processor (p), assembler (a) or linker (l)" }, { 'L', NULL, NULL, "Add the next field to the library search path" }, { 'l', NULL, NULL, "Include the given library in the link" }, { 0, OPTION_LARGE_MODEL, NULL, "external data space is used" }, @@ -935,23 +935,25 @@ parseCmdLine (int argc, char **argv) break; case 'W': + /* pre-processer options */ + if (argv[i][2] == 'p') + { + parseWithComma ((char **)preArgv, getStringArg("-Wp", argv, &i, argc)); + } /* linker options */ - if (argv[i][2] == 'l') + else if (argv[i][2] == 'l') { - parseWithComma(linkOptions, getStringArg("-Wl", argv, &i, argc)); - } - else - { - /* assembler options */ - if (argv[i][2] == 'a') - { - parseWithComma ((char **) asmOptions, getStringArg("-Wa", argv, &i, argc)); - } - else - { - werror (W_UNKNOWN_OPTION, argv[i]); - } + parseWithComma(linkOptions, getStringArg("-Wl", argv, &i, argc)); } + /* assembler options */ + else if (argv[i][2] == 'a') + { + parseWithComma ((char **) asmOptions, getStringArg("-Wa", argv, &i, argc)); + } + else + { + werror (W_UNKNOWN_OPTION, argv[i]); + } break; case 'v': diff --git a/support/Util/BuildCmd.c b/support/Util/BuildCmd.c index 2d0b051f..e45cece6 100644 --- a/support/Util/BuildCmd.c +++ b/support/Util/BuildCmd.c @@ -31,7 +31,7 @@ void buildCmdLine (char *into, const char **cmds, const char *p1, const char *p2, - const char *p3, const char **list) + const char *p3, const char * const *list) { const char *p, *from; @@ -66,7 +66,7 @@ buildCmdLine (char *into, const char **cmds, break; case 'l': { - const char **tmp = list; + const char *const *tmp = list; if (tmp) { while (*tmp) diff --git a/support/Util/BuildCmd.h b/support/Util/BuildCmd.h index 0dc403e0..34dd2cc4 100644 --- a/support/Util/BuildCmd.h +++ b/support/Util/BuildCmd.h @@ -29,6 +29,6 @@ void buildCmdLine (char *into, const char **cmds, const char *p1, const char *p2, - const char *p3, const char **list) ; + const char *p3, const char * const *list) ; #endif diff --git a/support/regression/tests/bug-478094.c b/support/regression/tests/bug-478094.c index c2de5618..10158421 100644 --- a/support/regression/tests/bug-478094.c +++ b/support/regression/tests/bug-478094.c @@ -6,7 +6,10 @@ int foo = 16; -extern void f( int x ); +void f( int x ) +{ + UNUSED(x); +} void g(int bar) { -- 2.30.2