Mark de Wever | 1 Mar 2009 07:56
Picon
Picon
Favicon

Re: GCC 4.4

On Sat, Feb 28, 2009 at 11:57:11PM -0600, Bruno Wolff III wrote:
> I have found what appears to be a legitimate complaint, but I think it might
> be an SDL macro issue rather than a bug in Wesnoth.

Seems a SDL problem to me as well. I assume it does this the transform
the data sent to network byte order. I guess we can't do much about it.

Slightly related, I'll add a new macro to define those buffers since
they should be 4 byte aligned on a Sparc [1], which I fixed at one place
but seems I missed the others. 

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=426318

--

-- 
Regards,
Mark de Wever aka Mordante/SkeletonCrew
Guillaume Melquiond | 1 Mar 2009 08:23
Picon

Re: GCC 4.4

On 2009/3/1, Mark de Wever wrote:
> On Sat, Feb 28, 2009 at 11:57:11PM -0600, Bruno Wolff III wrote:
>> I have found what appears to be a legitimate complaint, but I think it might
>> be an SDL macro issue rather than a bug in Wesnoth.
>
> Seems a SDL problem to me as well. I assume it does this the transform
> the data sent to network byte order. I guess we can't do much about it.

I wouldn't be so sure it is an SDL issue. Writing to a char buffer
through a Uint32* pointer is explicitly allowed (otherwise functions
like memcpy couldn't exist), as long as you read the resulting bytes
with either a char* or Uint32* pointer. So GCC may well be excessively
conservative here.

> Slightly related, I'll add a new macro to define those buffers since
> they should be 4 byte aligned on a Sparc [1], which I fixed at one place
> but seems I missed the others.

You don't need to align these buffers. At least not at the place Bruno
mentioned. SDL performs this macro expansion only on architecture with
unaligned accesses. For other ones (e.g. Sparc), SDLNet_Write* expands
to a one-byte-at-a-time write. So you would waste stack space for no
reason. Unless you intend to simply get rid of SDLNet_Write* and
provide an optimized version for aligned accesses, that is.

(Note that using our own SDLNet_{Read,Write}* functions would be a
good thing, even for x86 processors.)

Best regards,

(Continue reading)


Gmane