From: mc78 Date: Tue, 16 May 2017 11:13:09 +0000 (+0200) Subject: According to recent comments on my recent pull request, -Wc checking for -E flag... X-Git-Tag: V2.17~136^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=691df09a1f4a6b0f95b0d6eb7fd7320eb28df2b6;p=cc65 According to recent comments on my recent pull request, -Wc checking for -E flag has been removed again. Intead, -E flag has been added to cl65 without need of -Wc. Two functions have been introduced to disable compile, link or both. These function remove assigment repetions to DoAssemble and DoLink for litte overhead, having the maintainability in mind. --- diff --git a/src/cl65/main.c b/src/cl65/main.c index 58a1fe0c2..2172700ae 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -156,7 +156,21 @@ static char* TargetLib = 0; # endif #endif +/*****************************************************************************/ +/* Credential functions */ +/*****************************************************************************/ +void DisableAssembling(void){ + DoAssemble = 0; +} +void DisableLinking(void){ + DoLink = 0; +} + +void DisableAssemblingAndLinking(void){ + DisableAssembling(); + DisableLinking(); +} /*****************************************************************************/ /* Command structure handling */ @@ -1399,8 +1413,7 @@ int main (int argc, char* argv []) case 'S': /* Dont assemble and link the created files */ - DoAssemble = 0; - DoLink = 0; + DisableAssemblingAndLinking(); break; case 'T': @@ -1416,37 +1429,16 @@ int main (int argc, char* argv []) case 'E': /*Forward -E to compiler*/ CmdAddArg (&CC65, Arg); - DoAssemble = 0; - DoLink = 0; + DisableAssemblingAndLinking(); break; case 'W': if (Arg[2] == 'a' && Arg[3] == '\0') { /* -Wa: Pass options to assembler */ OptAsmArgs (Arg, GetArg (&I, 3)); - } - else if (Arg[2] == 'c' && Arg[3] == '\0') { + } else if (Arg[2] == 'c' && Arg[3] == '\0') { /* -Wc: Pass options to compiler */ - - /* Get argument succeeding -Wc switch */ - const char* WcSubArgs = GetArg (&I, 3); - /* Remember -Wc sub arguments in cc65 arg struct */ - OptCCArgs (Arg, WcSubArgs); - /* Check for isolated -E switch given after -Wc*/ - if (!strcmp("-E", WcSubArgs)){ - /*If both -Wc and -E given, then prevent assembling - and linking */ - DoAssemble = 0; - DoLink = 0; - }else{ - /* Check for -E beeing part of comma separated arg - list given after -Wc*/ - if ( (NULL!=strstr(WcSubArgs, "-E,")) || - (NULL!=strstr(WcSubArgs, ",-E"))){ - DoAssemble = 0; - DoLink = 0; - } - } + OptCCArgs (Arg, GetArg (&I, 3)); } else if (Arg[2] == 'l' && Arg[3] == '\0') { /* -Wl: Pass options to linker */ OptLdArgs (Arg, GetArg (&I, 3)); @@ -1458,7 +1450,7 @@ int main (int argc, char* argv []) case 'c': /* Don't link the resulting files */ - DoLink = 0; + DisableLinking(); break; case 'd':