]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Produce error when ".opt +o" or ".opt ~o" is encountered. Also, small doc additions
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index 0da81bec4ee37d3d4b941628f393c87f64b86a80..8ea0189e02ef740ecce71b59fad8c4b5076140f9 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -68,7 +68,6 @@ void strtoupper(char * s)
                *s++ &= 0xDF;
 }
 
-
 //
 // Manipulate file extension.
 //
@@ -145,7 +144,6 @@ int nthpath(char * env_var, int itemno, char * buf)
        return 1;
 }
 
-
 //
 // Display command line help
 //
@@ -185,7 +183,7 @@ void DisplayHelp(void)
                "                    o7: clr.l Dx to moveq #0,Dx                       (off)\n"
                "                    o8: adda.w/l #x,Dy to addq.w/l #x,Dy              (off)\n"
                "                    o9: adda.w/l #x,Dy to lea x(Dy),Dy                (off)\n"
-               "                    op: Enforce PC relative (alternative: o10)        (off)\n"
+               "                    o10: Enforce PC relative (alternative: op)        (off)\n"
                "  ~o[value]         Turn a specific optimisation off\n"
                "  +oall             Turn all optimisations on\n"
                "  ~oall             Turn all optimisations off\n"
@@ -223,7 +221,6 @@ void DisplayVersion(void)
                "V%01i.%01i.%01i %s (%s)\n\n", MAJOR, MINOR, PATCH, __DATE__, PLATFORM);
 }
 
-
 //
 // Parse optimisation options
 //
@@ -238,6 +235,9 @@ int ParseOptimization(char * optstring)
                else if (*optstring != '~')
                        return ERROR;
 
+        if (optstring[2] == 0)
+            return error(".opt called with zero arguments");
+
                if ((optstring[2] == 'a' || optstring[2] == 'A')
                        && (optstring[3] == 'l' || optstring[3] == 'L')
                        && (optstring[4] == 'l' || optstring[4] == 'L'))
@@ -284,7 +284,6 @@ int ParseOptimization(char * optstring)
        return OK;
 }
 
-
 //
 // Process command line arguments and do an assembly
 //
@@ -756,7 +755,6 @@ int Process(int argc, char ** argv)
        return errcnt;
 }
 
-
 //
 // Determine processor endianess
 //
@@ -771,7 +769,6 @@ int GetEndianess(void)
        return 1;
 }
 
-
 //
 // Application entry point
 //
@@ -798,4 +795,3 @@ int main(int argc, char ** argv)
 
        return 0;
 }
-