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

@@ -1383,16 +1383,15 @@ Note also that only exported symbols will appear in symbol and map files produce
.Xr rgblink 1 .
.Ss Purging symbols
.Ic PURGE
allows you to completely remove a symbol from the symbol table as if it had never existed.
.Em USE WITH EXTREME CAUTION !
I can't stress this enough,
.Sy you seriously need to know what you are doing .
DON'T purge a symbol that you use in expressions the linker needs to calculate.
When not sure, it's probably not safe to purge anything other than variables, numeric or string constants, or macros.
allows you to completely remove a symbol from the symbol table, as if it had never been defined.
Be
.Em very
careful when purging symbols, especially labels, because it could result in unpredictable errors if something depends on the missing symbol (for example, expressions the linker needs to calculate).
.Bd -literal -offset indent
DEF Kamikaze EQUS "I don't want to live anymore"
DEF AOLer EQUS "Me too"
PURGE Kamikaze, AOLer
DEF Kamikaze EQUS "I don't want to live anymore"
AOLer: DB "Me too lol"
PURGE Kamikaze, AOLer
ASSERT !DEF(Kamikaze) && !DEF(AOLer)
.Ed
.Pp
String constants are not expanded within the symbol names.