Page 1 of 1
[HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 12:33 pm
by Csonicgo
https://github.com/rheit/zdoom/blob/6d4 ... t.cpp#L159
https://github.com/rheit/zdoom/blob/6d4 ... t.cpp#L153
These two lines in this block of code:
Code: Select all
// We don't handle these. :(
case DTA_DestWidth:
case DTA_DestHeight:
*(DWORD *)tags = TAG_IGNORE; <--
data = va_arg (tags, DWORD);
break;
// Translation is specified explicitly by the text.
case DTA_Translation:
*(DWORD *)tags = TAG_IGNORE; <--
ptrval = va_arg (tags, void*);
break;
may cause an error on compilation on non x86-64 platforms, because type va_list cannot be cast to DWORD* (aka an unsigned int*) .
Solution: Change these offending lines to:
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 12:47 pm
by Graf Zahl
Csonicgo wrote:Solution: Change these offending lines to:
What does that solve? It only breaks the code.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 12:58 pm
by Blzut3
The offending lines are disabling invalid input before passing the tags off to character drawing. Unless I'm missing something (my test case for the change suggested was ECWolf's Android port, I imagine Beloko did the same for GZDoom's Android port), using asserts here is harmless since you should never input those values when drawing text.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 1:26 pm
by Csonicgo
Graf Zahl wrote:Csonicgo wrote:Solution: Change these offending lines to:
What does that solve? It only breaks the code.
Is there a better solution to this? This is the only showstopper in the code that prevents ARM compilation as far as I can tell.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 1:37 pm
by Graf Zahl
That code is still needed so just silencing the error and ignoring the problem is not going to help matters.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Wed Dec 10, 2014 1:46 pm
by Blzut3
Graf Zahl wrote:That code is still needed so just silencing the error and ignoring the problem is not going to help matters.
Mind to give me a line #? I don't see any calls to DrawText that use these tags, which makes sense since they appear to be no-ops.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Thu Dec 25, 2014 2:04 pm
by Graf Zahl
You are correct. These are never used by any DrawText call. I just replaced the offending code with an 'assert(false)'. Using these should be forbidden as they don't work anyway.
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Thu Dec 25, 2014 2:41 pm
by Edward-san
but in a release build, the 'assert' is simplified ... what about a 'I_(Fatal?)Error' call?
Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp
Posted: Thu Dec 25, 2014 2:54 pm
by Graf Zahl
This should be caught during development - and any new addition here will inevitably trigger the assert - and immediately be removed.