w32: include winsock2.h before windows.h
PATCH 1/1 w32: include winsock2.h before windows.h
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.
--- include/sysemu/os-win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/sysemu/os-win32.h +1 -1
@@ -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
Signature · 1 line
2.5.0
Quoted 16 lines · 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 <[email protected]>--- include/sysemu/os-win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/sysemu/os-win32.h +0
-0
include/sysemu/os-win32.h line 33
Quoted 9 lines
include/sysemu/os-win32.h +1
-1@@ -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
Signature · 4 lines
|: 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 :|
Quoted 6 lines · Daniel P. Berrange
On Tue, Feb 09, 2016 at 03:16:57PM +0100, Paolo Bonzini wrote:
include/qemu/sockets.halso haswindows.hincluded beforewinsock2.hPresumably it didn't cause a failure for you because everything using
sockets.halready pulls inosdep.h. A reason to prunesockets.hheaders 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
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Daniel P. Berrange
Quoted 6 lines · Paolo Bonzini
include/qemu/sockets.halso haswindows.hincluded beforewinsock2.hPresumably it didn't cause a failure for you because everything using
sockets.halready pulls inosdep.h. A reason to prunesockets.hheaders perhaps.More generally we could prune anything including
windows.hmanually (there are a dozen or so .c and .h files doing that currently).
I honestly do not have time to work on this. :(
Paolo
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Peter Maydell
Quoted 3 lines · Daniel P. Berrange
Quoted 3 lines · Paolo Bonzini
include/qemu/sockets.halso haswindows.hincluded beforewinsock2.h
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Presumably it didn't cause a failure for you because everything using
sockets.halready pulls inosdep.h. A reason to prunesockets.hheaders perhaps.More generally we could prune anything including
windows.hmanually (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
Am 09.02.2016 um 15:16 schrieb Paolo Bonzini:
Quoted 16 lines
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 <[email protected]>--- include/sysemu/os-win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/sysemu/os-win32.h +0
-0
include/sysemu/os-win32.h line 33
Quoted 9 lines
include/sysemu/os-win32.h +1
-1@@ -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
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.
Quoted 5 lines · Stefan Weil
Reviewed-by Stefan Weil <[email protected]>Without that patch,
windows.hwill includewinsock.h(which conflicts withwinsock2.h) when compilingsdl.c.
Quoted 9 lines
Normally we define
WIN32_LEAN_AND_MEAN, andwindows.hwon't includewinsock.h.
include/ui/sdl2.handui/sdl.cundefine 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
Michael Tokarev
AppliedQuoted 5 lines · 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.
Applied to -trivial, adding Stefan's comments to the commit message too.
Thanks,
/mjt