mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
-W-unreachable-code option added, alphabetic order of --list-warnings
This commit is contained in:
parent
5f8d163045
commit
eb1cf750f2
@ -555,6 +555,8 @@ Here is a description of all the command line options:
|
||||
Warn when passing structs by value.
|
||||
<tag><tt/unknown-pragma/</tag>
|
||||
Warn about #pragmas that aren't recognized by cc65.
|
||||
<tag><tt/unreachable-code/</tag>
|
||||
Warn about unreachable code in cases of comparing constants, etc.
|
||||
<tag><tt/unused-label/</tag>
|
||||
Warn about unused labels.
|
||||
<tag><tt/unused-param/</tag>
|
||||
|
@ -71,12 +71,13 @@ IntStack WarnNoEffect = INTSTACK(1); /* - statements without an effect */
|
||||
IntStack WarnPointerSign = INTSTACK(1); /* - pointer conversion to pointer differing in signedness */
|
||||
IntStack WarnPointerTypes = INTSTACK(1); /* - pointer conversion to incompatible pointer type */
|
||||
IntStack WarnRemapZero = INTSTACK(1); /* - remapping character code zero */
|
||||
IntStack WarnReturnType = INTSTACK(1); /* - control reaches end of non-void function */
|
||||
IntStack WarnStructParam = INTSTACK(0); /* - structs passed by val */
|
||||
IntStack WarnUnknownPragma = INTSTACK(1); /* - unknown #pragmas */
|
||||
IntStack WarnUnreachableCode= INTSTACK(1); /* - unreachable code */
|
||||
IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */
|
||||
IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */
|
||||
IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */
|
||||
IntStack WarnReturnType = INTSTACK(1); /* - control reaches end of non-void function */
|
||||
|
||||
/* Map the name of a warning to the intstack that holds its state */
|
||||
typedef struct WarnMapEntry WarnMapEntry;
|
||||
@ -92,12 +93,13 @@ static WarnMapEntry WarnMap[] = {
|
||||
{ &WarnPointerSign, "pointer-sign" },
|
||||
{ &WarnPointerTypes, "pointer-types" },
|
||||
{ &WarnRemapZero, "remap-zero" },
|
||||
{ &WarnReturnType, "return-type" },
|
||||
{ &WarnStructParam, "struct-param" },
|
||||
{ &WarnUnknownPragma, "unknown-pragma" },
|
||||
{ &WarnUnreachableCode, "unreachable-code" },
|
||||
{ &WarnUnusedLabel, "unused-label" },
|
||||
{ &WarnUnusedParam, "unused-param" },
|
||||
{ &WarnUnusedVar, "unused-var" },
|
||||
{ &WarnReturnType, "return-type" },
|
||||
};
|
||||
|
||||
Collection DiagnosticStrBufs;
|
||||
|
@ -68,12 +68,13 @@ extern IntStack WarnPointerSign; /* - pointer conversion to pointer diffe
|
||||
extern IntStack WarnPointerTypes; /* - pointer conversion to incompatible pointer type */
|
||||
extern IntStack WarnNoEffect; /* - statements without an effect */
|
||||
extern IntStack WarnRemapZero; /* - remapping character code zero */
|
||||
extern IntStack WarnReturnType; /* - control reaches end of non-void function */
|
||||
extern IntStack WarnStructParam; /* - structs passed by val */
|
||||
extern IntStack WarnUnknownPragma; /* - unknown #pragmas */
|
||||
extern IntStack WarnUnreachableCode; /* - unreachable code */
|
||||
extern IntStack WarnUnusedLabel; /* - unused labels */
|
||||
extern IntStack WarnUnusedParam; /* - unused parameters */
|
||||
extern IntStack WarnUnusedVar; /* - unused variables */
|
||||
extern IntStack WarnReturnType; /* - control reaches end of non-void function */
|
||||
|
||||
/* Forward */
|
||||
struct StrBuf;
|
||||
|
@ -187,7 +187,7 @@ static int IfStatement (void)
|
||||
/* If the if expression was always true, the code in the else branch
|
||||
** is never executed. Output a warning if this is the case.
|
||||
*/
|
||||
if (TestResult == TESTEXPR_TRUE) {
|
||||
if (TestResult == TESTEXPR_TRUE && IS_Get (&WarnUnreachableCode)) {
|
||||
Warning ("Unreachable code");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user