All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
@ 2016-02-09 14:16 Paolo Bonzini
  2016-02-09 14:21 ` Daniel P. Berrange
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Paolo Bonzini @ 2016-02-09 14:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Recent Fedora complains while compiling ui/sdl.c:

    /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]

And with this patch we dutifully obey.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/sysemu/os-win32.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 400e098..fbed346 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -26,8 +26,8 @@
 #ifndef QEMU_OS_WIN32_H
 #define QEMU_OS_WIN32_H
 
-#include <windows.h>
 #include <winsock2.h>
+#include <windows.h>
 
 /* Workaround for older versions of MinGW. */
 #ifndef ECONNREFUSED
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:16 [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h Paolo Bonzini
@ 2016-02-09 14:21 ` Daniel P. Berrange
  2016-02-09 14:28   ` Peter Maydell
  2016-02-09 16:03 ` Stefan Weil
  2016-02-11  5:56 ` Michael Tokarev
  2 siblings, 1 reply; 8+ messages in thread
From: Daniel P. Berrange @ 2016-02-09 14:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel

On Tue, Feb 09, 2016 at 03:16:57PM +0100, Paolo Bonzini wrote:
> Recent Fedora complains while compiling ui/sdl.c:
> 
>     /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
> 
> And with this patch we dutifully obey.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/sysemu/os-win32.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
> index 400e098..fbed346 100644
> --- a/include/sysemu/os-win32.h
> +++ b/include/sysemu/os-win32.h
> @@ -26,8 +26,8 @@
>  #ifndef QEMU_OS_WIN32_H
>  #define QEMU_OS_WIN32_H
>  
> -#include <windows.h>
>  #include <winsock2.h>
> +#include <windows.h>
>  
>  /* Workaround for older versions of MinGW. */
>  #ifndef ECONNREFUSED

include/qemu/sockets.h also has windows.h included before winsock2.h

Presumably it didn't cause a failure for you because everything using
sockets.h already pulls in osdep.h. A reason to prune sockets.h
headers perhaps.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:21 ` Daniel P. Berrange
@ 2016-02-09 14:28   ` Peter Maydell
  2016-02-09 14:37     ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2016-02-09 14:28 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: QEMU Trivial, Paolo Bonzini, QEMU Developers

On 9 February 2016 at 14:21, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Tue, Feb 09, 2016 at 03:16:57PM +0100, Paolo Bonzini wrote:
> include/qemu/sockets.h also has windows.h included before winsock2.h
>
> Presumably it didn't cause a failure for you because everything using
> sockets.h already pulls in osdep.h. A reason to prune sockets.h
> headers perhaps.

More generally we could prune anything including windows.h manually
(there are a dozen or so .c and .h files doing that currently).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:28   ` Peter Maydell
@ 2016-02-09 14:37     ` Paolo Bonzini
  2016-02-09 14:38       ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2016-02-09 14:37 UTC (permalink / raw)
  To: Peter Maydell, Daniel P. Berrange; +Cc: QEMU Trivial, QEMU Developers



On 09/02/2016 15:28, Peter Maydell wrote:
> On 9 February 2016 at 14:21, Daniel P. Berrange <berrange@redhat.com> wrote:
>> > On Tue, Feb 09, 2016 at 03:16:57PM +0100, Paolo Bonzini wrote:
>> > include/qemu/sockets.h also has windows.h included before winsock2.h
>> >
>> > Presumably it didn't cause a failure for you because everything using
>> > sockets.h already pulls in osdep.h. A reason to prune sockets.h
>> > headers perhaps.
> More generally we could prune anything including windows.h manually
> (there are a dozen or so .c and .h files doing that currently).

I honestly do not have time to work on this. :(

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:37     ` Paolo Bonzini
@ 2016-02-09 14:38       ` Peter Maydell
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2016-02-09 14:38 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Trivial, QEMU Developers

On 9 February 2016 at 14:37, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 09/02/2016 15:28, Peter Maydell wrote:
>> On 9 February 2016 at 14:21, Daniel P. Berrange <berrange@redhat.com> wrote:
>>> > On Tue, Feb 09, 2016 at 03:16:57PM +0100, Paolo Bonzini wrote:
>>> > include/qemu/sockets.h also has windows.h included before winsock2.h
>>> >
>>> > Presumably it didn't cause a failure for you because everything using
>>> > sockets.h already pulls in osdep.h. A reason to prune sockets.h
>>> > headers perhaps.
>> More generally we could prune anything including windows.h manually
>> (there are a dozen or so .c and .h files doing that currently).
>
> I honestly do not have time to work on this. :(

That's OK, I currently have a bunch of include file cleanups
going through so one more won't hurt too much :-)

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:16 [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h Paolo Bonzini
  2016-02-09 14:21 ` Daniel P. Berrange
@ 2016-02-09 16:03 ` Stefan Weil
  2016-02-09 16:06   ` Paolo Bonzini
  2016-02-11  5:56 ` Michael Tokarev
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2016-02-09 16:03 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial, Peter Maydell

Am 09.02.2016 um 15:16 schrieb Paolo Bonzini:
> Recent Fedora complains while compiling ui/sdl.c:
>
>     /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
>
> And with this patch we dutifully obey.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/sysemu/os-win32.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
> index 400e098..fbed346 100644
> --- a/include/sysemu/os-win32.h
> +++ b/include/sysemu/os-win32.h
> @@ -26,8 +26,8 @@
>  #ifndef QEMU_OS_WIN32_H
>  #define QEMU_OS_WIN32_H
>  
> -#include <windows.h>
>  #include <winsock2.h>
> +#include <windows.h>
>  
>  /* Workaround for older versions of MinGW. */
>  #ifndef ECONNREFUSED

Reviewed-by: Stefan Weil <sw@weilnetz.de>

Without that patch, windows.h will include winsock.h
(which conflicts with winsock2.h) when compiling sdl.c.

Normally we define WIN32_LEAN_AND_MEAN, and
windows.h won't include winsock.h.

include/ui/sdl2.h and ui/sdl.c undefine that macro,
so the order of the include files is important.

Without testing this, I think that Paolo's patch is needed
since commit e16f4c8770b73f530dad842a31298963b6c7e41d.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 16:03 ` Stefan Weil
@ 2016-02-09 16:06   ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2016-02-09 16:06 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: qemu-trivial, Peter Maydell



On 09/02/2016 17:03, Stefan Weil wrote:
> Reviewed-by: Stefan Weil <sw@weilnetz.de>
> 
> Without that patch, windows.h will include winsock.h
> (which conflicts with winsock2.h) when compiling sdl.c.
> 
> Normally we define WIN32_LEAN_AND_MEAN, and
> windows.h won't include winsock.h.
> 
> include/ui/sdl2.h and ui/sdl.c undefine that macro,
> so the order of the include files is important.
> 
> Without testing this, I think that Paolo's patch is needed
> since commit e16f4c8770b73f530dad842a31298963b6c7e41d.
> 

That also explains why only that file complains.  Thanks!

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h
  2016-02-09 14:16 [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h Paolo Bonzini
  2016-02-09 14:21 ` Daniel P. Berrange
  2016-02-09 16:03 ` Stefan Weil
@ 2016-02-11  5:56 ` Michael Tokarev
  2 siblings, 0 replies; 8+ messages in thread
From: Michael Tokarev @ 2016-02-11  5:56 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial, Stefan Weil

09.02.2016 17:16, Paolo Bonzini wrote:
> Recent Fedora complains while compiling ui/sdl.c:
> 
>     /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
> 
> And with this patch we dutifully obey.

Applied to -trivial, adding Stefan's comments to the commit
message too.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-11  5:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 14:16 [Qemu-devel] [PATCH] w32: include winsock2.h before windows.h Paolo Bonzini
2016-02-09 14:21 ` Daniel P. Berrange
2016-02-09 14:28   ` Peter Maydell
2016-02-09 14:37     ` Paolo Bonzini
2016-02-09 14:38       ` Peter Maydell
2016-02-09 16:03 ` Stefan Weil
2016-02-09 16:06   ` Paolo Bonzini
2016-02-11  5:56 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.