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