sourcepawn icon indicating copy to clipboard operation
sourcepawn copied to clipboard

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

Open nosoop opened this issue 3 years ago • 3 comments

#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:

  • 1.11.0.6911
  • 1.12.0.6949

nosoop avatar Dec 19 '22 12:12 nosoop

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

dvander avatar Feb 24 '23 04:02 dvander

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 avatar Feb 24 '23 14:02 asherkin

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.

asherkin avatar Mar 01 '23 18:03 asherkin