1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-29 10:29:30 +00:00

Fix output of --help regarding -W. Added new option --list-warnings.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5005 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-05-01 17:42:49 +00:00
parent ea32400df4
commit 928c76235f
4 changed files with 47 additions and 5 deletions

View 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.

View 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 */
/*****************************************************************************/

View 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) */

View 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 },