C99 types patch

Eamon Walsh ewalsh at tycho.nsa.gov
Wed Oct 21 20:56:46 PDT 2009


On 10/05/2009 10:08 PM, Eric Anholt wrote:
> On Mon, 2009-10-05 at 15:35 -0400, Adam Jackson wrote:
>   
>> On Sun, 2009-10-04 at 12:08 +1100, Daniel Stone wrote:
>>     
>>> On Fri, Oct 02, 2009 at 01:42:50PM -0700, Jamey Sharp wrote:
>>>       
>>>> On 64-bit systems, int and pointers don't have the same size, so GCC gives
>>>> warnings about casts between int and pointer types. However, in the cases
>>>> covered by this patch, it's always a value that fits in int being stored
>>>> temporarily as a pointer and then converted back later, which is safe.
>>>> Casting through the pointer-sized integer type intptr_t convinces the
>>>> compiler that this is OK.
>>>>
>>>> Signed-off-by: Jamey Sharp <jamey at minilop.net>
>>>>         
>>> Alan, Matthieu -- is this portable enough?
>>>       
>> intptr_t is part of stdint.h in C99, but seems to also be in unistd.h in
>> UNIX98, which is nearly universal by this point unlike C99.
>>
>> I would love love love to see us move entirely to stdint types instead
>> of the mess we've got now.
>>     
> Yes.  Yes yes yes.
>   

I have a patch sitting around that does this, guess I'll float it.

The key file is x11proto/Xmd.h.  Xdefs.h and X.h also have some
redefinitions.  I just moved what I could into Xmd.h since both other
headers include it.

The behavior in configure.ac is kind of naive.  The proper solution
probably involves some kind of Xmd.h.in file.

--Eamon


-------------- next part --------------
A non-text attachment was scrubbed...
Name: c99_types.patch
Type: text/x-patch
Size: 7195 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20091021/e3b51201/attachment.bin 


More information about the xorg-devel mailing list