* [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
@ 2010-05-15 20:49 Blue Swirl
2010-05-15 21:39 ` Stefan Weil
2010-05-17 8:35 ` Markus Armbruster
0 siblings, 2 replies; 7+ messages in thread
From: Blue Swirl @ 2010-05-15 20:49 UTC (permalink / raw)
To: qemu-devel
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(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-15 20:49 [Qemu-devel] [PATCH 0/3] mingw32 compile fixes Blue Swirl
@ 2010-05-15 21:39 ` Stefan Weil
2010-05-16 8:24 ` Blue Swirl
2010-05-17 8:35 ` Markus Armbruster
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2010-05-15 21:39 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
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?
Regards
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-15 21:39 ` Stefan Weil
@ 2010-05-16 8:24 ` Blue Swirl
2010-05-17 8:37 ` Markus Armbruster
0 siblings, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2010-05-16 8:24 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On 5/16/10, Stefan Weil <weil@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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-15 20:49 [Qemu-devel] [PATCH 0/3] mingw32 compile fixes Blue Swirl
2010-05-15 21:39 ` Stefan Weil
@ 2010-05-17 8:35 ` Markus Armbruster
1 sibling, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2010-05-17 8:35 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
Would you mind sending patch series with proper References: headers, so
that the parts of the series are properly threaded?
You can ask either git-format-patch or git-send-email to add them.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-16 8:24 ` Blue Swirl
@ 2010-05-17 8:37 ` Markus Armbruster
2010-05-17 16:01 ` Blue Swirl
0 siblings, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2010-05-17 8:37 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
Blue Swirl <blauwirbel@gmail.com> writes:
> On 5/16/10, Stefan Weil <weil@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:
[...]
>> > 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.
[...]
>> 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.
They're also ugly as sin.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-17 8:37 ` Markus Armbruster
@ 2010-05-17 16:01 ` Blue Swirl
2010-05-17 16:48 ` Markus Armbruster
0 siblings, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2010-05-17 16:01 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On 5/17/10, Markus Armbruster <armbru@redhat.com> wrote:
> Blue Swirl <blauwirbel@gmail.com> writes:
>
> > On 5/16/10, Stefan Weil <weil@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:
>
> [...]
>
> >> > 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.
>
> [...]
>
> >> 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.
>
>
> They're also ugly as sin.
Avi's signature tells the reason, the macros are products of standards
committees.
But on second thought, perhaps it's not OK standard-wise to invent
PRIz* macros, at least they should be prefixed with Q to avoid
conflict. That probably does not improve the beauty of the macros. ;-)
I also noticed the SCN* macros now. We are incorrectly using PRI*
macros where SCN* should be used. Too bad this doesn't solve the %hh
problem, SCNx8 is not defined on mingw32.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes
2010-05-17 16:01 ` Blue Swirl
@ 2010-05-17 16:48 ` Markus Armbruster
0 siblings, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2010-05-17 16:48 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
Blue Swirl <blauwirbel@gmail.com> writes:
> On 5/17/10, Markus Armbruster <armbru@redhat.com> wrote:
>> Blue Swirl <blauwirbel@gmail.com> writes:
>>
>> > On 5/16/10, Stefan Weil <weil@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:
>>
>> [...]
>>
>> >> > 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.
>>
>> [...]
>>
>> >> 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.
>>
>>
>> They're also ugly as sin.
>
> Avi's signature tells the reason, the macros are products of standards
> committees.
Committees have much ugliness to answer for, but they're not to blame
for ugly printing of size_t, signed char, unsigned char, long long and
unsigned long long. In fact, the committee came up with a non-ugly
solution for them: conversion specification length modifiers z, hh, ll.
> But on second thought, perhaps it's not OK standard-wise to invent
> PRIz* macros, at least they should be prefixed with Q to avoid
> conflict.
Correct.
> That probably does not improve the beauty of the macros. ;-)
And correct again.
All this ugliness just to silence a single compiler's broken warnings?
I'd switch off the warning and be done with it.
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-05-17 16:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-15 20:49 [Qemu-devel] [PATCH 0/3] mingw32 compile fixes Blue Swirl
2010-05-15 21:39 ` Stefan Weil
2010-05-16 8:24 ` Blue Swirl
2010-05-17 8:37 ` Markus Armbruster
2010-05-17 16:01 ` Blue Swirl
2010-05-17 16:48 ` Markus Armbruster
2010-05-17 8:35 ` Markus Armbruster
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).