Current detection is strong for translation-unit-local mistakes, but it is not whole-program unused-code detection. The two PRs expose different gaps, so no single extra compiler flag will solve both.
| Mechanism | Currently catches | Main gaps |
|---|---|---|
Compiler warnings + -Werror |
Scalars, internal functions, some private members, unreachable code | Non-trivial value objects; public/external/virtual methods; unused parameters intentionally disabled |
| clang-tidy | Unused using declarations, selected ignored return values |
No configured non-trivial-local or cross-TU dead-declaration check |
| IWYU | Unnecessary includes in an enforced subset | Not functions/types; much of wallet, tests, fuzz, Qt, and IPC is non-enforcing |
| Ruff/ShellCheck | Python imports/locals and shell variables | Python functions/classes; C++ declarations |
| LTO/dead stripping | Removes unreachable emitted code in selected builds | Does not fail CI, misses source-only code, and vtables can retain unused virtual methods |