ID:2482197
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
We have warnings for unused variables but I don't believe we have warnings for unused defines. Is there any reason we don't?
Unused defines are inconsequential. And sometimes intentional.
Why?
Don't they slow down compile time slightly?
Inconsequentially.

Also basically every general purpose library would generate a huge number of warnings especially when naming bitflags using #defines, and forward-thinking stuff like utility macros.
Don't know about unused, but warnings about double defines would be nice.
defines are a stack, this is a feature that can be used intentionally for code maintenance benefits between modules or libraries.

#define blah "foo"
world << blah //outputs foo
#define blah "bar"
world << blah //outputs bar
#undef blah
world << blah //outputs foo
#undef blah
world << blah //compile error.


When it comes to preventing namespace collision, this allows modules or libraries to not worry about conflicting with a define by the main code by just unsetting it at the end. Even if the main code defined the define before the module/library, it's value will be preserved.