]> git.sur5r.net Git - cc65/commitdiff
Fix output of --help regarding -W. Added new option --list-warnings.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 1 May 2011 17:42:49 +0000 (17:42 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 1 May 2011 17:42:49 +0000 (17:42 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5005 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/cc65.sgml
src/cc65/error.c
src/cc65/error.h
src/cc65/main.c

index 027e75020bec0421e6f9f789e2589a58f9e4c0c0..a1731879add1b65a20f1cf30a1d9e68bffd92fc3 100644 (file)
@@ -61,7 +61,7 @@ Short options:
   -Os                           Inline some known functions
   -T                            Include source as comment
   -V                            Print the compiler version number
-  -W                            Suppress warnings
+  -W warning[,...]              Suppress warnings
   -d                            Debug mode
   -g                            Add debug info to object file
   -h                            Help (this text)
@@ -92,6 +92,7 @@ Long options:
   --help                        Help (this text)
   --include-dir dir             Set an include directory search path
   --list-opt-steps              List all optimizer steps and exit
+  --list-warnings               List available warning types for -W
   --local-strings               Emit string literals immediately
   --memory-model model          Set the memory model
   --register-space b            Set space available for register variables
@@ -222,6 +223,13 @@ Here is a description of all the command line options:
   Print the short option summary shown above.
 
 
+  <label id="option-list-warnings">
+  <tag><tt>--list-warnings</tt></tag>
+
+  List the names of warning types available for use with <tt><ref
+  id="option-W" name="-W"></tt>.
+
+
   <label id="option-local-strings">
   <tag><tt>--local-strings</tt></tag>
 
@@ -491,6 +499,9 @@ Here is a description of all the command line options:
         Warn about unused variables.
   </descrip>
 
+  The full list of available warning names may be retrieved by using the
+  option <tt><ref id="option-list-warnings" name="--list-warnings"></tt>.
+
   You may also use <tt><ref id="pragma-warn" name="#pragma&nbsp;warn"></tt> to
   control this setting for smaller pieces of code from within your code.
 
index 1b4a04e85a52406993f3630250ef6e1a04e9a91a..2fe399702fbf6418b44cee641822bdc49d1af68c 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2010, Ullrich von Bassewitz                                      */
+/* (C) 1998-2011, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -299,6 +299,17 @@ IntStack* FindWarning (const char* Name)
 
 
 
+void ListWarnings (FILE* F)
+/* Print a list of warning types/names to the given file */
+{
+    unsigned I;
+    for (I = 0; I < sizeof(WarnMap) / sizeof (WarnMap[0]); ++I) {
+        fprintf (F, "%s\n", WarnMap[I].Name);
+    }
+}
+
+
+
 /*****************************************************************************/
 /*                                   Code                                    */
 /*****************************************************************************/
index ce8bacb512bf176d94621aa32982a21853ee777e..5830367e1d37d30fb721a1c440a6eed5c54c6e62 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2010, Ullrich von Bassewitz                                      */
+/* (C) 1998-2011, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -38,6 +38,8 @@
 
 
 
+#include <stdio.h>
+
 /* common */
 #include "attrib.h"
 #include "intstack.h"
@@ -106,6 +108,9 @@ IntStack* FindWarning (const char* Name);
  * intstack that holds its state. Return NULL if there is no such warning.
  */
 
+void ListWarnings (FILE* F);
+/* Print a list of warning types/names to the given file */
+
 void ErrorReport (void);
 /* Report errors (called at end of compile) */
 
index 692b7fe7a2f7fa0f7f91ae955e13df1b16e1cda7..85ca5170a46ba2538872ad7d59912e125346dc2c 100644 (file)
@@ -92,7 +92,7 @@ static void Usage (void)
             "  -Os\t\t\t\tInline some known functions\n"
             "  -T\t\t\t\tInclude source as comment\n"
             "  -V\t\t\t\tPrint the compiler version number\n"
-            "  -W\t\t\t\tSuppress warnings\n"
+            "  -W warning[,...]\t\tSuppress warnings\n"
             "  -d\t\t\t\tDebug mode\n"
             "  -g\t\t\t\tAdd debug info to object file\n"
             "  -h\t\t\t\tHelp (this text)\n"
@@ -123,6 +123,7 @@ static void Usage (void)
             "  --help\t\t\tHelp (this text)\n"
             "  --include-dir dir\t\tSet an include directory search path\n"
             "  --list-opt-steps\t\tList all optimizer steps and exit\n"
+            "  --list-warnings\t\tList available warning types for -W\n"
             "  --local-strings\t\tEmit string literals immediately\n"
             "  --memory-model model\t\tSet the memory model\n"
             "  --register-space b\t\tSet space available for register variables\n"
@@ -543,7 +544,7 @@ static void OptHelp (const char* Opt attribute ((unused)),
 
 static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg)
 /* Add an include search path */
-{                        
+{
     AddSearchPath (SysIncSearchPath, Arg);
     AddSearchPath (UsrIncSearchPath, Arg);
 }
@@ -563,6 +564,19 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
 
 
 
+static void OptListWarnings (const char* Opt attribute ((unused)),
+                            const char* Arg attribute ((unused)))
+/* List all warning types */
+{
+    /* List the warnings */
+    ListWarnings (stdout);
+
+    /* Terminate */
+    exit (EXIT_SUCCESS);
+}
+
+
+
 static void OptLocalStrings (const char* Opt attribute ((unused)),
                             const char* Arg attribute ((unused)))
 /* Emit string literals immediately */
@@ -769,6 +783,7 @@ int main (int argc, char* argv[])
        { "--help",             0,      OptHelp                 },
        { "--include-dir",      1,      OptIncludeDir           },
        { "--list-opt-steps",   0,      OptListOptSteps         },
+               { "--list-warnings",    0,      OptListWarnings         },
         { "--local-strings",    0,      OptLocalStrings         },
         { "--memory-model",     1,      OptMemoryModel          },
         { "--register-space",   1,      OptRegisterSpace        },