alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
363 stars 62 forks source link

`#pragma deprecated` raises warnings on usage within unused stock functions #865

Open nosoop opened 1 year ago

nosoop commented 1 year ago
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    // nothing here...
}

#pragma deprecated This function is deprecated.
stock void UnusedFunction()
{
    NestedUnusedFunction();
}

#pragma deprecated This nested function is also deprecated.
stock void NestedUnusedFunction()
{

}
scripting\test_sourcepawn_deprecated_stock.sp(14) : warning 234: symbol "NestedUnusedFunction" is marked as deprecated: This nested function is also deprecated.

1 Warning.

Reproduced on the following SourceMod revisions:

dvander commented 1 year ago

This is intentional. Even if a stock is unused, it goes through full error reporting in 1.11+.

asherkin commented 1 year ago

This seems like something that would be nice to suppress - perhaps only when the stock itself is marked as deprecated? Otherwise there is no warning-free migration path for libraries.

asherkin commented 1 year ago

Reopening this as (briefly) discussed on Discord - a PR would be much appreciated for this one and it sounds like it'll be quite a while otherwise.