diff options
| author | gingerBill <bill@gingerbill.org> | 2024-04-11 15:24:36 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-04-11 15:24:36 +0100 |
| commit | b6d2ac11b8a3fa34542333966f3958602b6ba2c8 (patch) | |
| tree | 267eb2b350163b766a3d772ccfa2eb5159a30996 /src/checker.cpp | |
| parent | 6c38ae36580156171c453579942991b431f6b27b (diff) | |
Add `-vet-unused-variables` and ``-vet-unused-imports` (`-vet-unused` is both)
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 3556c4647..35554cf44 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -728,7 +728,10 @@ gb_internal void check_scope_usage(Checker *c, Scope *scope, u64 vet_flags) { } else if (vet_flags) { switch (ve.kind) { case VettedEntity_Unused: - if (vet_flags & VetFlag_Unused) { + if (e->kind == Entity_Variable && (vet_flags & VetFlag_UnusedVariables) != 0) { + error(e->token, "'%.*s' declared but not used", LIT(name)); + } + if ((e->kind == Entity_ImportName || e->kind == Entity_LibraryName) && (vet_flags & VetFlag_UnusedImports) != 0) { error(e->token, "'%.*s' declared but not used", LIT(name)); } break; |