X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fmain.c;h=3785716dfafc1bdaa7e543757df16ec88f24cbfd;hb=ed2767e65f05b853eda1b071938062126de6f517;hp=ef8f648c03ac38eae7e2a7ea8e444919ab28b78b;hpb=b829bda8cbb3669ea90bcfac6a70acac2c0c6ae5;p=cc65 diff --git a/src/cc65/main.c b/src/cc65/main.c index ef8f648c0..3785716df 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -48,6 +48,7 @@ #include "mmodel.h" #include "print.h" #include "segnames.h" +#include "strbuf.h" #include "target.h" #include "tgttrans.h" #include "version.h" @@ -177,10 +178,6 @@ static void SetSys (const char* Sys) cbmsys ("__C128__"); break; - case TGT_ACE: - cbmsys ("__ACE__"); - break; - case TGT_PLUS4: cbmsys ("__PLUS4__"); break; @@ -667,13 +664,59 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the compiler version */ { fprintf (stderr, - "cc65 V%u.%u.%u\n" - "SVN version: %s\n", - VER_MAJOR, VER_MINOR, VER_PATCH, SVNVersion); + "cc65 V%s\nSVN version: %s\n", + GetVersionAsString (), SVNVersion); + exit (EXIT_SUCCESS); +} + + + +static void OptWarning (const char* Opt attribute ((unused)), const char* Arg) +/* Handle the -W option */ +{ + StrBuf W = AUTO_STRBUF_INITIALIZER; + + /* Arg is a list of suboptions, separated by commas */ + while (Arg) { + + const char* Pos; + int Enabled = 1; + IntStack* S; + + /* The suboption may be prefixed with '-' or '+' */ + if (*Arg == '-') { + Enabled = 0; + ++Arg; + } else if (*Arg == '+') { + /* This is the default */ + ++Arg; + } + + /* Get the next suboption */ + Pos = strchr (Arg, ','); + if (Pos) { + SB_CopyBuf (&W, Arg, Pos - Arg); + Arg = Pos + 1; + } else { + SB_CopyStr (&W, Arg); + Arg = 0; + } + SB_Terminate (&W); + + /* Search for the warning */ + S = FindWarning (SB_GetConstBuf (&W)); + if (S == 0) { + InvArg (Opt, SB_GetConstBuf (&W)); + } + IS_Set (S, Enabled); + } + + /* Free allocated memory */ + SB_Done (&W); } @@ -745,9 +788,9 @@ int main (int argc, char* argv[]) const char* Arg = ArgVec[I]; /* Check for an option */ - if (Arg [0] == '-') { + if (Arg[0] == '-') { - switch (Arg [1]) { + switch (Arg[1]) { case '-': LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); @@ -800,7 +843,7 @@ int main (int argc, char* argv[]) default: UnknownOption (Arg); break; - } + } } break; @@ -843,7 +886,7 @@ int main (int argc, char* argv[]) break; case 'W': - IS_Set (&WarnDisable, 1); + OptWarning (Arg, GetArg (&I, 2)); break; default: