[PATCH 5/5] test: Fix compiler warning on 64-bit.

Eric Anholt eric at anholt.net
Mon Feb 3 20:34:37 CET 2014


Mark Kettenis <mark.kettenis at xs4all.nl> writes:

>> From: Eric Anholt <eric at anholt.net>
>> Date: Mon, 27 Jan 2014 11:36:09 -0800
>> 
>> We all know that XIDs are 32 bits, even if 32-bit headers call them
>> "long".
>> ---
>>  test/hashtabletest.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/test/hashtabletest.c b/test/hashtabletest.c
>> index ceadfa7..a37dfb5 100644
>> --- a/test/hashtabletest.c
>> +++ b/test/hashtabletest.c
>> @@ -12,7 +12,7 @@ static void
>>  print_xid(void* ptr, void* v)
>>  {
>>      XID *x = v;
>> -    printf("%ld", *x);
>> +    printf("%d", (uint32_t)*x);
>>  }
>
> There is no guarantee that uint32_t isn't long either!  And of course
> using %d to print an unsigned integer isn't quite right either.

That's super pedantic.  Do you know of a platform where that's the
case?

Regardless, I've changed it to cast to int.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140203/64b3f298/attachment.pgp>


More information about the xorg-devel mailing list