[PATCH] dix: silence compiler warning

Daniel Stone daniel at fooishbar.org
Mon Apr 18 02:01:13 PDT 2011


Hi,

On Mon, Apr 18, 2011 at 09:26:54AM +0200, Mark Kettenis wrote:
> > resource.c: In function 'AddResource':
> > resource.c:493:3: warning: format '%lx' expects type 'long unsigned int',
> > but argument 3 has type 'RESTYPE'
> > 
> > RESTYPE is uint32_t, not long.
> 
> Well, uint32_t isn't a fundamental type.  And while the most natural
> thing on ILP32 and LP64 systems is to typedef it as unsigned int, it
> may actually be unsigned long on some systems.  It probably is on Windows.

Right.  So, glibc supports PRIu32 and friends in stdint.h so you can do
this:
    uint32_t foo = 0xabcdef01;
    printf("uint32_t: %"PRIu32"\n", foo);

But it's non-portable, and also seriously ugly.  Oh well.

Anyway, given that this quashes the warning on the most common
development platform:
Reviewed-by: Daniel Stone <daniel at fooishbar.org>

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110418/70fdf8f5/attachment.pgp>


More information about the xorg-devel mailing list