[Top][All Lists]

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

Re: [Qemu-block] [Qemu-devel] [PULL 00/32] Block layer patches

From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PULL 00/32] Block layer patches
Date: Mon, 11 Jul 2016 10:25:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 07/11/2016 10:14 AM, Peter Maydell wrote:

> Format string warning on OSX, I'm afraid:
> /Users/pm215/src/qemu-for-merges/qemu-io-cmds.c:393:69: warning:
> format specifies type 'size_t' (aka 'unsigned long') but the argument
> has type 'unsigned long long' [-Wformat]
>             printf("Argument '%s' exceeds maximum size %zu\n", arg, SIZE_MAX);
>                                                        ~~~          ^~~~~~~~
>                                                        %llu
> /usr/include/stdint.h:153:20: note: expanded from macro 'SIZE_MAX'
> #define SIZE_MAX          UINT64_MAX
>                           ^~~~~~~~~~
> /usr/include/stdint.h:87:27: note: expanded from macro 'UINT64_MAX'
> #define UINT64_MAX        18446744073709551615ULL
>                           ^~~~~~~~~~~~~~~~~~~~~~~
> This is a bug in the OSX system headers, but we need to work around
> it. This came up last year for some other format strings in the
> some source file, so the same fix should be ok here:
> https://patchwork.ozlabs.org/patch/542327/

Back then, our "fix" was a hack to add an explicit (uint64_t) cast at
the point of the printf, but that doesn't scale.  Wouldn't a better fix
be to osdep.h to add something along the lines of:

#if witness_for_buggy_header
#undef SIZE_MAX
#define SIZE_MAX working expression

so that it is fixed in one place for all uses?

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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