mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +00:00
Fix the warning that is produced for unused functions
This commit is contained in:
parent
216bb22b20
commit
0fbf2af09d
@ -78,6 +78,7 @@ 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 WarnUnusedFunc = INTSTACK(1); /* - unused functions */
|
||||
|
||||
/* Map the name of a warning to the intstack that holds its state */
|
||||
typedef struct WarnMapEntry WarnMapEntry;
|
||||
@ -97,6 +98,7 @@ static WarnMapEntry WarnMap[] = {
|
||||
{ &WarnStructParam, "struct-param" },
|
||||
{ &WarnUnknownPragma, "unknown-pragma" },
|
||||
{ &WarnUnreachableCode, "unreachable-code" },
|
||||
{ &WarnUnusedFunc, "unused-func" },
|
||||
{ &WarnUnusedLabel, "unused-label" },
|
||||
{ &WarnUnusedParam, "unused-param" },
|
||||
{ &WarnUnusedVar, "unused-var" },
|
||||
|
@ -75,6 +75,7 @@ extern IntStack WarnUnreachableCode; /* - unreachable code */
|
||||
extern IntStack WarnUnusedLabel; /* - unused labels */
|
||||
extern IntStack WarnUnusedParam; /* - unused parameters */
|
||||
extern IntStack WarnUnusedVar; /* - unused variables */
|
||||
extern IntStack WarnUnusedFunc; /* - unused functions */
|
||||
|
||||
/* Forward */
|
||||
struct StrBuf;
|
||||
|
@ -173,6 +173,10 @@ static void CheckSymTable (SymTable* Tab)
|
||||
if (IS_Get (&WarnUnusedParam)) {
|
||||
Warning ("Parameter '%s' is never used", Entry->Name);
|
||||
}
|
||||
} else if (Flags & SC_FUNC) {
|
||||
if (IS_Get (&WarnUnusedFunc)) {
|
||||
Warning ("Function '%s' is defined but never used", Entry->Name);
|
||||
}
|
||||
} else {
|
||||
if (IS_Get (&WarnUnusedVar)) {
|
||||
Warning ("Variable '%s' is defined but never used", Entry->Name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user