[PATCH] Suppress a warning about mismatched parameter in format string (expected long int, provided unsigned int).

Thomas Dickey dickey at radix.net
Wed Apr 25 04:12:10 PDT 2007


On Wed, Apr 25, 2007 at 06:17:22AM -0400, Zephaniah E. Hull wrote:
> On Wed, Apr 25, 2007 at 03:06:27AM +0200, Giuseppe Bilotta wrote:
> > -            xf86Msg(X_ERROR, "Read error: %s (%d, %d != %ld)\n",
> > +            xf86Msg(X_ERROR, "Read error: %s (%d, %d != %u)\n",
> >  		    strerror(errno), errno, len, sizeof (ev));
> 
> See, this is one of those funky cases where fixing the warning is the
> wrong answer.
> 
> See, on x86 sizeof returns an int, on amd64 sizeof returns a long, which
> makes it slightly harder to avoid a warning on all systems without using
> a cast.

A cast would fix the problem, but it should be for an unsigned type,
since the "%ld" was incorrect to begin with (or unsigned long ;-)

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20070425/79af6a3c/attachment.pgp>


More information about the xorg mailing list