On 5/16/10, Stefan Weil <w...@mail.berlios.de> wrote: > Am 15.05.2010 22:49, schrieb Blue Swirl: > > > > Hi, > > > > With this mingw32 compiler: > > > > $ i586-mingw32msvc-gcc -v > > Using built-in specs. > > Target: i586-mingw32msvc > > Configured with: > > > /tmp/buildd/gcc-mingw32-4.4.2/build-tree/gcc-4.4.2/configure > > --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' > > --mandir='/usr/share/man' --infodir='/usr/share/info' > > --sysconfdir=/etc --localstatedir=/var > > --libexecdir='/usr/lib/gcc-mingw32' --disable-multilib > > --enable-threads --enable-sjlj-exceptions > > --enable-version-specific-runtime-libs --disable-shared > > --target=i586-mingw32msvc > --enable-languages=c,c++,fortran : > > (reconfigured) > /tmp/buildd/gcc-mingw32-4.4.2/build-tree/gcc-4.4.2/configure > > --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' > > --mandir='/usr/share/man' --infodir='/usr/share/info' > > --sysconfdir=/etc --localstatedir=/var > > --libexecdir='/usr/lib/gcc-mingw32' --disable-multilib > > --enable-threads --enable-sjlj-exceptions > > --enable-version-specific-runtime-libs --disable-shared > > --target=i586-mingw32msvc > --enable-languages=c,c++,fortran > > Thread model: win32 > > gcc version 4.4.2 (GCC) > > > > build will not succeed because formats %zd, %zu, %hh, %lld, %llx and > > %llu are not known by the compiler. > > > > Any %ll* use is clearly a bug, we have PRI*64 macros just for this > purpose. > > > > For %hh and %z there may be better ways than these patches. > > > > With the patches I can build working Win32 binaries and there are no > warnings. > > > > Blue Swirl (3): > > Fix %lld or %llx printf format use > > mingw32: avoid using %hh format which is not known by the compiler > > mingw32: avoid using %zd etc. formats which are not known by the > > compiler > > > > arch_init.c | 18 +++++++++++++ > > audio/audio.c | 11 ++++--- > > audio/audio_template.h | 4 +- > > audio/esdaudio.c | 8 +++--- > > audio/mixeng.c | 3 +- > > audio/ossaudio.c | 8 +++--- > > block/curl.c | 13 +++++---- > > block/parallels.c | 7 +++- > > block/qcow2.c | 10 ++++--- > > buffered_file.c | 13 +++++---- > > darwin-user/commpage.c | 2 +- > > darwin-user/syscall.c | 2 +- > > hw/ac97.c | 4 +- > > hw/eepro100.c | 22 +++++++++------ > > hw/loader.c | 8 +++--- > > hw/scsi-bus.c | 4 +- > > hw/scsi-disk.c | 16 ++++++------ > > hw/usb-ohci.c | 7 +++-- > > hw/vga.c | 2 +- > > hw/vhost_net.c | 2 +- > > hw/virtio-9p-debug.c | 2 +- > > hw/virtio-9p.c | 2 +- > > hw/xen_console.c | 3 +- > > hw/xen_disk.c | 6 +++- > > hw/xenfb.c | 9 ++++-- > > ia64-dis.c | 9 ++++-- > > nbd.c | 4 +- > > osdep.c | 2 +- > > qemu-common.h | 7 +++++ > > qemu-img.c | 10 +++--- > > qemu-io.c | 57 > +++++++++++++++++++++-------------------- > > sysemu.h | 4 +++ > > target-cris/translate.c | 6 ++-- > > target-microblaze/translate.c | 2 +- > > target-ppc/translate.c | 7 +++-- > > target-sparc/helper.c | 2 +- > > usb-linux.c | 2 +- > > vnc-auth-sasl.c | 2 +- > > vnc.c | 9 +++--- > > 39 files changed, 182 insertions(+), 127 deletions(-) > > > > > > It's a compiler bug that the compiler does not know these format strings. > The code works nevertheless (at least with mingw libraries which are > not too old) because the format strings are interpreted by the C runtime > library. > > Is it worth changing a lot of files when we can expect a newer mingw > compiler version which works correctly for standard format strings?
When and if that version becomes popular, PRIz* and the %hh hack could be removed or a compiler check could be added. But I don't think it's worth it, the macros are easy to use.