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 #endif 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
signature.asc
Description: OpenPGP digital signature