sourcepawn
sourcepawn copied to clipboard
No warning for unused enum struct fields and methods
Code
enum struct Thing
{
bool a;
bool b;
void DoThing()
{
}
}
public void OnPluginStart()
{
Thing t;
t.a = true;
}
produces no warning for unused symbols b
and DoThing
.
Tested in spcomp 1.11.0.6846
I don't see us adding this warning. We don't check for unused types, and we don't check for unused properties/nethods of types.
Fair enough. My reasoning was that the compiler already checks for unused global vars and methodmap functions, and ES are used by developers in a similar fashion. I can't think of a scenario where one would want to declare ES properties/methods and never use them. Whenever I do this, it's by mistake. Even though they're just arrays under the hood, their declaration is more explicit and they can't be sanely passed via natives, so if the properties/methods aren't used locally, they're just dead code/memory. (unless I'm missing a use case where this isn't true)