All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] es1370: Fix compiler warnings for debug code
Date: Sat, 02 Oct 2010 11:46:24 +0200	[thread overview]
Message-ID: <4CA6FF70.3040902@mail.berlios.de> (raw)
In-Reply-To: <m3eic922p1.fsf@blackfin.pond.sub.org>

Am 01.10.2010 20:22, schrieb Markus Armbruster:
> Stefan Weil <weil@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	other threads:[~2010-10-02  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 19:08 [Qemu-devel] [PATCH] es1370: Fix compiler warnings for debug code Stefan Weil
2010-09-30 20:33 ` malc
2010-10-01 18:05   ` [Qemu-devel] [PATCH v2] " Stefan Weil
2010-10-01 18:22     ` Markus Armbruster
2010-10-02  9:46       ` Stefan Weil [this message]
2010-10-02 10:20       ` [Qemu-devel] [PATCH v3] " Stefan Weil
2010-10-02 14:10         ` [Qemu-devel] " malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA6FF70.3040902@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=armbru@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.