From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 2/2] target-ppc: Cast ssize_t to size_t before printing with %zx
Date: Wed, 24 Dec 2014 10:47:32 +0100 [thread overview]
Message-ID: <549A8BB4.6030002@weilnetz.de> (raw)
In-Reply-To: <CAFEAcA9=vXpz97XRxy+ubme_bpX-tizG60YZ0JXpm4+56dza-A@mail.gmail.com>
Am 23.12.2014 um 23:47 schrieb Peter Maydell:
> On 23 December 2014 at 22:36, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 23.12.2014 um 23:22 schrieb Peter Maydell:
>>> --- a/hw/ppc/spapr.c
>>> +++ b/hw/ppc/spapr.c
>>> @@ -1438,7 +1438,7 @@ static void ppc_spapr_init(MachineState *machine)
>>> }
>>> if (spapr->rtas_size > RTAS_MAX_SIZE) {
>>> hw_error("RTAS too big ! 0x%zx bytes (max is 0x%x)\n",
>>> - spapr->rtas_size, RTAS_MAX_SIZE);
>>> + (size_t)spapr->rtas_size, RTAS_MAX_SIZE);
>>> exit(1);
>>> }
>>> g_free(filename);
>>
>>
>> Which compiler did you use? I get no warning with Debian's
>> x86_64-w64-mingw32-gcc 4.6.3 or
>> native MinGW-w32 compilers.
>
> $ i586-mingw32msvc-gcc --version
> i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)
>
> Yes, this is ancient... it's from the Debian mingw32 package.
> I just use this for compile testing, not for trying to run.
> I should probably switch to the w64 compiler for build tests;
> I forget now if there was a reason why I hadn't.
>
> I suspect, as I say, that this is just a generic old-gcc bug,
> but it's the only one in the codebase, so it seems easiest
> just to fix it.
>
> -- PMM
"git grep" finds 6 "%zx", 66 "%zu" and 80 "%zd" in my QEMU source tree.
Some of those are in debug traces, others are conditionally compiled
depending on your configuration. Are you sure that none of those needs
the same kind of modification, too? I don't thing fixing one of them for
an ancient compiler is worth the trouble of explaining why there is a
type cast.
What about using hwaddr instead of ssize_t for rtas_size (and
HWADDR_PRIx in the format string)? It looks like that would be more
consistent with the rest of the code. See for example the arguments of
function spapr_finalize_fdt.
Stefan
next prev parent reply other threads:[~2014-12-24 9:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 22:22 [Qemu-devel] [PATCH 0/2] target-ppc: Fix clang and w32 warnings Peter Maydell
2014-12-23 22:22 ` [Qemu-devel] [PATCH 1/2] target-ppc: Mark SR() and gen_sync_exception() as !CONFIG_USER_ONLY Peter Maydell
2014-12-23 22:22 ` [Qemu-devel] [PATCH 2/2] target-ppc: Cast ssize_t to size_t before printing with %zx Peter Maydell
2014-12-23 22:36 ` Stefan Weil
2014-12-23 22:47 ` Peter Maydell
2014-12-24 9:47 ` Stefan Weil [this message]
2014-12-23 22:50 ` Eric Blake
2014-12-23 23:09 ` Peter Maydell
2014-12-23 23:25 ` [Qemu-devel] [PATCH 0/2] target-ppc: Fix clang and w32 warnings Alexander Graf
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=549A8BB4.6030002@weilnetz.de \
--to=sw@weilnetz.de \
--cc=agraf@suse.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).