Reduce deprecated script warning text

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Reduce deprecated script warning text

Post by Major Cooke »

I would like to suggest that warnings like this:

Code: Select all

Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Call to deprecated function CharAt
Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0
...be squished down to:

Code: Select all

Script warning, "AEoDdat.pk3:zaeod/eventhandler.txt" line 428:
Accessing deprecated function CharAt - deprecated since 4.1.0
When there's a lot to read, that's a lot of needless text being duplicated, especially the "script warning" lines being needlessly duplicated.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Reduce deprecated script warning text

Post by Nash »

On a related note, would it be possible to suggest what to replace the deprecated function with, so that people can stop making forum posts asking "what should I use in place of CharAt"? :P
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Reduce deprecated script warning text

Post by Major Cooke »

I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Reduce deprecated script warning text

Post by phantombeta »

Major Cooke wrote:I don't think that should be too hard, if the deprecated function is expanded to include an extra parameter.
It's not a function, it's an attribute. And ZScript's attributes are built into the ZScript parser. So, uh... Good luck. This is coming from someone who worked on the JIT and made several PRs for the ZScript compiler.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reduce deprecated script warning text

Post by Graf Zahl »

You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Reduce deprecated script warning text

Post by phantombeta »

Graf Zahl wrote:You'd have to make a change to the grammar but this won't have to filter down to the JIT, the message should be emitted in the resolving pass.
???
I never said it would affect the JIT, I was saying it would be a pain in the ass, because the lemon and the parser are ass.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reduce deprecated script warning text

Post by Graf Zahl »

Code: Select all

decl_flags(X) ::= decl_flags(F) DEPRECATED(B) LPAREN STRCONST(A) COMMA STRCONST(C) RPAREN.	
{ 
	if (F == nullptr)
	{
		NEW_AST_NODE(DeclFlags,nil_f,B.SourceLoc);
		X = nil_f;
		X->Flags = ZCC_Deprecated;
		X->Id = nullptr;
		X->Version = { 0, 0 };
	}
	else
	{
		X = F;
		X->Flags |= ZCC_Deprecated;
	}
	X->Version = A.String->GetChars();
	// Do something with C here.
}
That's all you need in the parser.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Reduce deprecated script warning text

Post by _mental_ »

Doubling of depreciation warnings was fixed some time ago.

For optional depreciation messages, I made this PR. It doesn’t contain any messages, fill free to make PRs with then (if this change will be merged of course).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reduce deprecated script warning text

Post by Graf Zahl »

Merged. The last point about adding messages still stands, of course.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Reduce deprecated script warning text

Post by Nash »

Thanks _mental_! I'll try and add some message PRs as soon as I'm able (expect at least one more question thread about deprecated function replacements :P)
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Reduce deprecated script warning text

Post by Rachael »

If possible, I think the deprecation notices should suggest new functions for you to use. Of course, that requires contextually handling every deprecation, and that might be a bit messy... but it would still be really helpful.
Post Reply

Return to “Feature Suggestions [GZDoom]”