expand deprecation allowance for gzdoom.pk3

This commit is contained in:
Ricardo Luís Vaz Silva 2025-01-13 11:33:43 -03:00
commit e543e26bdc
4 changed files with 24 additions and 21 deletions

View file

@ -6783,11 +6783,8 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
{
if (sym->mVersion <= ctx.Version)
{
// Allow use of deprecated symbols in deprecated functions of the internal code. This is meant to allow deprecated code to remain as it was,
// even if it depends on some deprecated symbol.
// The main motivation here is to keep the deprecated static functions accessing the global level variable as they were.
// Print these only if debug output is active and at the highest verbosity level.
const bool internal = (ctx.Function->Variants[0].Flags & VARF_Deprecated) && fileSystem.GetFileContainer(ctx.Lump) == 0;
// Allow use of deprecated symbols in the internal code.
const bool internal = fileSystem.GetFileContainer(ctx.Lump) == 0;
const FString &deprecationMessage = vsym->DeprecationMessage;
ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
@ -6877,8 +6874,12 @@ FxExpression *FxIdentifier::ResolveMember(FCompileContext &ctx, PContainerType *
{
if (sym->mVersion <= ctx.Version)
{
// Allow use of deprecated symbols in internal code.
const bool internal = fileSystem.GetFileContainer(ctx.Lump) == 0;
const FString &deprecationMessage = vsym->DeprecationMessage;
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated member variable %s - deprecated since %d.%d.%d%s%s", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision,
ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
"Accessing deprecated member variable %s - deprecated since %d.%d.%d%s%s", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision,
deprecationMessage.IsEmpty() ? "" : ", ", deprecationMessage.GetChars());
}
}
@ -9661,8 +9662,12 @@ bool FxVMFunctionCall::CheckAccessibility(const VersionInfo &ver)
{
if (Function->mVersion <= ver)
{
// Allow use of deprecated symbols in internal code.
const bool internal = fileSystem.GetFileContainer(Function->OwningClass->mDefFileNo) == 0;
const FString &deprecationMessage = Function->Variants[0].DeprecationMessage;
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated function %s - deprecated since %d.%d.%d%s%s", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision,
ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
"Accessing deprecated function %s - deprecated since %d.%d.%d%s%s", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision,
deprecationMessage.IsEmpty() ? "" : ", ", deprecationMessage.GetChars());
}
}