#include "mmodel.h"
#include "print.h"
#include "segnames.h"
+#include "strbuf.h"
#include "target.h"
#include "tgttrans.h"
#include "version.h"
cbmsys ("__C128__");
break;
- case TGT_ACE:
- cbmsys ("__ACE__");
- break;
-
case TGT_PLUS4:
cbmsys ("__PLUS4__");
break;
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);
}
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]));
default:
UnknownOption (Arg);
break;
- }
+ }
}
break;
break;
case 'W':
- IS_Set (&WarnDisable, 1);
+ OptWarning (Arg, GetArg (&I, 2));
break;
default: