Implement -Wpurge= (#1443)

This commit is contained in:
Sylvie
2024-08-05 12:50:48 -04:00
committed by GitHub
parent f304e1dd7f
commit 2f8f99bd94
14 changed files with 59 additions and 10 deletions

View File

@@ -169,6 +169,10 @@ void sym_Purge(std::string const &symName) {
} else if (sym->ID != (uint32_t)-1) {
error("Symbol \"%s\" is referenced and thus cannot be purged\n", symName.c_str());
} else {
if (sym->isExported)
warning(WARNING_PURGE_1, "Purging an exported symbol \"%s\"\n", symName.c_str());
else if (sym->isLabel())
warning(WARNING_PURGE_2, "Purging a label \"%s\"\n", symName.c_str());
// Do not keep a reference to the label's name after purging it
if (sym->name == labelScope)
labelScope = std::nullopt;