mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Allow to disable the "Result of comparison is constant" warning.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4883 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
e907b57e9c
commit
3f5b2a8fbd
@ -469,10 +469,14 @@ Here is a description of all the command line options:
|
|||||||
|
|
||||||
The following warning names are currently recognized:
|
The following warning names are currently recognized:
|
||||||
<descrip>
|
<descrip>
|
||||||
|
<tag><tt/const-comparison/</tag>
|
||||||
|
Warn if the result of a comparison is constant.
|
||||||
<tag><tt/error/</tag>
|
<tag><tt/error/</tag>
|
||||||
Treat all warnings as errors.
|
Treat all warnings as errors.
|
||||||
<tag><tt/no-effect/</tag>
|
<tag><tt/no-effect/</tag>
|
||||||
Warn about statements that don't have an effect.
|
Warn about statements that don't have an effect.
|
||||||
|
<tag><tt/struct-param/</tag>
|
||||||
|
Warn when passing structs by value.
|
||||||
<tag><tt/unknown-pragma/</tag>
|
<tag><tt/unknown-pragma/</tag>
|
||||||
Warn about known #pragmas.
|
Warn about known #pragmas.
|
||||||
<tag><tt/unused-label/</tag>
|
<tag><tt/unused-label/</tag>
|
||||||
|
@ -64,12 +64,13 @@ unsigned WarningCount = 0;
|
|||||||
IntStack WarnEnable = INTSTACK(1); /* Enable warnings */
|
IntStack WarnEnable = INTSTACK(1); /* Enable warnings */
|
||||||
IntStack WarningsAreErrors = INTSTACK(0); /* Treat warnings as errors */
|
IntStack WarningsAreErrors = INTSTACK(0); /* Treat warnings as errors */
|
||||||
/* Warn about: */
|
/* Warn about: */
|
||||||
IntStack WarnNoEffect = INTSTACK(1); /* ... statements without an effect */
|
IntStack WarnConstComparison= INTSTACK(1); /* - constant comparison results */
|
||||||
IntStack WarnStructParam = INTSTACK(1); /* ... structs passed by val */
|
IntStack WarnNoEffect = INTSTACK(1); /* - statements without an effect */
|
||||||
IntStack WarnUnusedLabel = INTSTACK(1); /* ... unused labels */
|
IntStack WarnStructParam = INTSTACK(1); /* - structs passed by val */
|
||||||
IntStack WarnUnusedParam = INTSTACK(1); /* ... unused parameters */
|
IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */
|
||||||
IntStack WarnUnusedVar = INTSTACK(1); /* ... unused variables */
|
IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */
|
||||||
IntStack WarnUnknownPragma = INTSTACK(1); /* ... unknown #pragmas */
|
IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */
|
||||||
|
IntStack WarnUnknownPragma = INTSTACK(1); /* - unknown #pragmas */
|
||||||
|
|
||||||
/* Map the name of a warning to the intstack that holds its state */
|
/* Map the name of a warning to the intstack that holds its state */
|
||||||
typedef struct WarnMapEntry WarnMapEntry;
|
typedef struct WarnMapEntry WarnMapEntry;
|
||||||
@ -80,6 +81,7 @@ struct WarnMapEntry {
|
|||||||
static WarnMapEntry WarnMap[] = {
|
static WarnMapEntry WarnMap[] = {
|
||||||
/* Keep sorted, even if this isn't used for now */
|
/* Keep sorted, even if this isn't used for now */
|
||||||
{ &WarningsAreErrors, "error" },
|
{ &WarningsAreErrors, "error" },
|
||||||
|
{ &WarnConstComparison, "const-comparison" },
|
||||||
{ &WarnNoEffect, "no-effect" },
|
{ &WarnNoEffect, "no-effect" },
|
||||||
{ &WarnStructParam, "struct-param" },
|
{ &WarnStructParam, "struct-param" },
|
||||||
{ &WarnUnknownPragma, "unknown-pragma" },
|
{ &WarnUnknownPragma, "unknown-pragma" },
|
||||||
|
@ -61,12 +61,13 @@ extern unsigned WarningCount;
|
|||||||
extern IntStack WarnEnable; /* Enable warnings */
|
extern IntStack WarnEnable; /* Enable warnings */
|
||||||
extern IntStack WarningsAreErrors; /* Treat warnings as errors */
|
extern IntStack WarningsAreErrors; /* Treat warnings as errors */
|
||||||
/* Warn about: */
|
/* Warn about: */
|
||||||
extern IntStack WarnNoEffect; /* ... statements without an effect */
|
extern IntStack WarnConstComparison; /* - constant comparison results */
|
||||||
extern IntStack WarnStructParam; /* ... structs passed by val */
|
extern IntStack WarnNoEffect; /* - statements without an effect */
|
||||||
extern IntStack WarnUnusedLabel; /* ... unused labels */
|
extern IntStack WarnStructParam; /* - structs passed by val */
|
||||||
extern IntStack WarnUnusedParam; /* ... unused parameters */
|
extern IntStack WarnUnusedLabel; /* - unused labels */
|
||||||
extern IntStack WarnUnusedVar; /* ... unused variables */
|
extern IntStack WarnUnusedParam; /* - unused parameters */
|
||||||
extern IntStack WarnUnknownPragma; /* ... unknown #pragmas */
|
extern IntStack WarnUnusedVar; /* - unused variables */
|
||||||
|
extern IntStack WarnUnknownPragma; /* - unknown #pragmas */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ static void WarnConstCompareResult (void)
|
|||||||
* preprocessor mode.
|
* preprocessor mode.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if (!Preprocessing) {
|
if (!Preprocessing && IS_Get (&WarnConstComparison) != 0) {
|
||||||
Warning ("Result of comparison is constant");
|
Warning ("Result of comparison is constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user