qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] target-ppc: Cast ssize_t to size_t before p


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/2] target-ppc: Cast ssize_t to size_t before printing with %zx
Date: Tue, 23 Dec 2014 23:09:47 +0000

On 23 December 2014 at 22:50, Eric Blake <address@hidden> wrote:
> What's the actual compiler warning you got? This feels like it won't
> work if the real problem is the compiler telling you that %z is unknown;
> conversely, if it is a mismatch between 'size_t' vs. 'ssize_t', we
> probably ought to report it to the mingw folks to fix their environment
> to use the same underlying type for signed vs. unsigned sizes.

It complains:
hw/ppc/spapr.c: In function ‘ppc_spapr_init’:
hw/ppc/spapr.c:1441: warning: format ‘%zx’ expects type ‘size_t’, but
argument 2 has type ‘ssize_t’

and unsurprisingly casting to size_t suppresses it.

%zd gets me:

hw/ppc/spapr.c:1441: warning: format ‘%zd’ expects type ‘signed
size_t’, but argument 2 has type ‘ssize_t’

which is curious. (But we want the hex output anyway...)

Grepping through the headers suggests we have

typedef long _ssize_t;
typedef _ssize_t ssize_t;

I think 'size_t' ends up 'long unsigned int', though stddef.h is
tricky to interpret because of all the macros.

In any case, AIUI mingw isn't really maintained any more, and
so the answer is either "do what is needed to shut up the compiler"
or "declare mingw actually not supported and require mingw-w64"...

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]