[HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

by Graf Zahl » Thu Dec 25, 2014 2:54 pm

This should be caught during development - and any new addition here will inevitably trigger the assert - and immediately be removed.

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

by Edward-san » Thu Dec 25, 2014 2:41 pm

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

by Graf Zahl » Thu Dec 25, 2014 2:04 pm

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

by Blzut3 » Wed Dec 10, 2014 1:46 pm

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

by Graf Zahl » Wed Dec 10, 2014 1:37 pm

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

by Csonicgo » Wed Dec 10, 2014 1:26 pm

Graf Zahl wrote:
Csonicgo wrote:Solution: Change these offending lines to:

Code: Select all

assert(false && "unsupported");

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

by Blzut3 » Wed Dec 10, 2014 12:58 pm

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

by Graf Zahl » Wed Dec 10, 2014 12:47 pm

Csonicgo wrote:Solution: Change these offending lines to:

Code: Select all

assert(false && "unsupported");

What does that solve? It only breaks the code.

[HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

by Csonicgo » Wed Dec 10, 2014 12:33 pm

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:

Code: Select all

assert(false && "unsupported");

Top