[3.5.1] warning for modder error appears only in GZD debug

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

[3.5.1] warning for modder error appears only in GZD debug

Post by Matt »

To replicate:
Run this build of Hideous Destructor which contains the following function:

Code: Select all

	override double,int weaponbulk(){
		int mgg=weaponstatus[PISS_MAG];
		return 30+(mgg<0?0:(ENC_9MAG_LOADED+mgg*ENC_9_LOADED)); //this should also return an int but doesn't
	}
Expected: Error or warning that it's failing to return one of the values.

Actual: Lots of assertion errors that only appear in debug that someone who only uses release will never see.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by _mental_ »

It's pretty easy to turn this into an error (or warning but as we all know they are usually ignored).

The problem is the fix will treat void function returning void as an error too. I.e. the following code will no longer work

Code: Select all

void func1()
{
}

void func2
{
    return func1();
}
Dear reader, if you think that the given code sample is artificial, you are wrong. Take a look at this line from GZDoom core script.
Of course it's a piece of cake to fix it for GZDoom. Although, I tested the change with D4D and HD, and they both failed to load thanks to usage of such constructs.

I found no good way to handle 'void returns void' thing so far.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by Graf Zahl »

They shouldn't be handled. Period. The mere fact that the core script is doing it just means that something was overlooked. But I guess if this needs to be handled, the check needs to be versioned then, i.e. only error out for script version 3.7 and up and print a warning if lower.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by Graf Zahl »

Pity that you analyzed it but didn't point to the problem spot. Now I have to do it all over again. :(
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by _mental_ »

Here is my attempt to fix this issue. It doesn't have version check though. I found it in a local branch and made PR for reference only.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by drfrag »

Now the engine won't start (version mismatch), i think the ZScript version needs to be bumped.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by Graf Zahl »

It starts for me. Are you sure you are completely up to date with everything?

Are these in your version.h?

#define VER_MAJOR 3
#define VER_MINOR 7
#define VER_REVISION 0
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by drfrag »

I forgot it was bumped in master, now it's fixed.
User avatar
Major Cooke
Posts: 8176
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by Major Cooke »

_mental_ wrote: Dear reader, if you think that the given code sample is artificial, you are wrong. Take a look at this line from GZDoom core script.
Of course it's a piece of cake to fix it for GZDoom. Although, I tested the change with D4D and HD, and they both failed to load thanks to usage of such constructs.

I found no good way to handle 'void returns void' thing so far.
It's code like that which inspired me to use it, along with some other modders. Convenience and all: calls the function and terminate the current one. Alright, I'll go back through and fix it. So is it just a warning?
Last edited by Major Cooke on Thu Nov 01, 2018 8:39 am, edited 2 times in total.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by _mental_ »

It's an error with ZScript version 3.7 or above.

EDIT: Curiously enough 'void returns void' case is valid in C/C++ but not in C# or Java.
Last edited by _mental_ on Thu Nov 01, 2018 8:45 am, edited 2 times in total.
User avatar
Major Cooke
Posts: 8176
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [3.5.1] warning for modder error appears only in GZD deb

Post by Major Cooke »

Alright. Will fix it on my end then.
Post Reply

Return to “Closed Bugs [GZDoom]”