Am 01.10.2010 20:22, schrieb Markus Armbruster:
Stefan Weil <w...@mail.berlios.de> writes:
The patch fixes these gcc warnings:

./hw/es1370.c: In function ‘es1370_update_voices’:
./hw/es1370.c:411: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
./hw/es1370.c: In function ‘es1370_writel’:
./hw/es1370.c:579: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:589: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ ./hw/es1370.c:606: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
./hw/es1370.c: In function ‘es1370_readl’:
./hw/es1370.c:748: error: suggest braces around empty body in an ‘if’ statement

v2

* Use %zd for pointer differences (ptrdiff_t or ssize_t).
The gcc error message ("long int") was misleading.
Malc, thank you for this hint.

The correct length modifier for ptrdiff_t is 't', not 'z'.
ISO/IEC 9899:1999 7.19.6.1:

z Specifies that a following d, i, o, u, x, or X
conversion specifier applies to a size_t or the
corresponding signed integer type argument; or
that a following n conversion specifier applies
to a pointer to a signed integer type
corresponding to size_t argument.

t Specifies that a following d, i, o, u, x, or X
conversion specifier applies to a ptrdiff_t or
the corresponding unsigned integer type
argument; or that a following n conversion
specifier applies to a pointer to a ptrdiff_t
argument.

Not that it makes a difference in practice.


It's always good to learn more. I must admit that I never
used %td before, but it exists, it is obviously supported,
so it should be used.

Therefore I'll send a third version of my patch, and also
patches which fix the other locations in qemu which use
%zd instead of %td for ptrdiff_t.

Thanks,
Stefan


Reply via email to