]> git.sur5r.net Git - cc65/blobdiff - src/cc65/main.c
Changed names of the pragmas to be identical to the corresponding command line
[cc65] / src / cc65 / main.c
index abcd090bfd4fe21c306724191e8f7033c740b29d..3785716dfafc1bdaa7e543757df16ec88f24cbfd 100644 (file)
@@ -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"
@@ -64,8 +65,9 @@
 #include "macrotab.h"
 #include "output.h"
 #include "scanner.h"
-#include "standard.h"
 #include "segments.h"
+#include "standard.h"
+#include "svnversion.h"
 
 
 
@@ -176,10 +178,6 @@ static void SetSys (const char* Sys)
            cbmsys ("__C128__");
            break;
 
-       case TGT_ACE:
-           cbmsys ("__ACE__");
-           break;
-
        case TGT_PLUS4:
            cbmsys ("__PLUS4__");
            break;
@@ -666,12 +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",
-                    VER_MAJOR, VER_MINOR, VER_PATCH);
+                    "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);
 }
 
 
@@ -743,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]));
@@ -798,7 +843,7 @@ int main (int argc, char* argv[])
                            default:
                                UnknownOption (Arg);
                                break;
-                       }
+                       }
                    }
                    break;
 
@@ -841,7 +886,7 @@ int main (int argc, char* argv[])
                            break;
 
                        case 'W':
-                           IS_Set (&WarnDisable, 1);
+                    OptWarning (Arg, GetArg (&I, 2));
                            break;
 
                        default: