<descrip>
<tag><tt/error/</tag>
Treat all warnings as errors.
+ <tag><tt/no-effect/</tag>
+ Warn about statements that don't have an effect.
<tag><tt/unknown-pragma/</tag>
Warn about known #pragmas.
<tag><tt/unused-label/</tag>
/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Warning and error options */
IntStack WarnEnable = INTSTACK(1); /* Enable warnings */
IntStack WarningsAreErrors = INTSTACK(0); /* Treat warnings as errors */
-IntStack WarnStructParam = INTSTACK(1); /* Warn about structs passed by val */
-IntStack WarnUnusedLabel = INTSTACK(1); /* Warn about unused labels */
-IntStack WarnUnusedParam = INTSTACK(1); /* Warn about unused parameters */
-IntStack WarnUnusedVar = INTSTACK(1); /* Warn about unused variables */
-IntStack WarnUnknownPragma = INTSTACK(1); /* Warn about unknown #pragmas */
+ /* Warn about: */
+IntStack WarnNoEffect = INTSTACK(1); /* ... statements without an effect */
+IntStack WarnStructParam = INTSTACK(1); /* ... structs passed by val */
+IntStack WarnUnusedLabel = INTSTACK(1); /* ... unused labels */
+IntStack WarnUnusedParam = INTSTACK(1); /* ... unused parameters */
+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 */
typedef struct WarnMapEntry WarnMapEntry;
static WarnMapEntry WarnMap[] = {
/* Keep sorted, even if this isn't used for now */
{ &WarningsAreErrors, "error" },
+ { &WarnNoEffect, "no-effect" },
{ &WarnStructParam, "struct-param" },
{ &WarnUnknownPragma, "unknown-pragma" },
{ &WarnUnusedLabel, "unused-label" },
/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Warning and error options */
extern IntStack WarnEnable; /* Enable warnings */
extern IntStack WarningsAreErrors; /* Treat warnings as errors */
-extern IntStack WarnStructParam; /* Warn about structs passed by val */
-extern IntStack WarnUnusedLabel; /* Warn about unused labels */
-extern IntStack WarnUnusedParam; /* Warn about unused parameters */
-extern IntStack WarnUnusedVar; /* Warn about unused variables */
-extern IntStack WarnUnknownPragma; /* Warn about unknown #pragmas */
+ /* Warn about: */
+extern IntStack WarnNoEffect; /* ... statements without an effect */
+extern IntStack WarnStructParam; /* ... structs passed by val */
+extern IntStack WarnUnusedLabel; /* ... unused labels */
+extern IntStack WarnUnusedParam; /* ... unused parameters */
+extern IntStack WarnUnusedVar; /* ... unused variables */
+extern IntStack WarnUnknownPragma; /* ... unknown #pragmas */
/* Done */
return S;
-}
+}
int Push;
/* A warning name must follow */
- IntStack* S =GetWarning (B);
+ IntStack* S = GetWarning (B);
if (S == 0) {
return;
}
/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
* void, emit a warning.
*/
GetCodePos (&End);
- if (CodeRangeIsEmpty (&Start, &End) && !IsTypeVoid (Expr.Type)) {
+ if (CodeRangeIsEmpty (&Start, &End) &&
+ !IsTypeVoid (Expr.Type) &&
+ IS_Get (&WarnNoEffect)) {
Warning ("Statement has no effect");
}
CheckSemi (PendingToken);