Skip to contentSkip to conversation

[6783] Fix windows build and clean up use of <windows.h>

Qemu-devel Anthony Liguori 1 participant 1 message Mar 8, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6783

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6783
Author:   aliguori
Date:     2009-03-08 16:26:59 +0000 (Sun, 08 Mar 2009)

Log Message:
-----------
Fix windows build and clean up use of <windows.h>

We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so let's do it in OS_CFLAGS.

Then, we can pepper in windows.h includes where using #includes that require it.

Modified Paths:
--------------

    trunk/block-raw-win32.c
    trunk/block.c
    trunk/configure
    trunk/kqemu.c
    trunk/net.c
    trunk/osdep.c
    trunk/qemu-common.h
    trunk/qemu-img.c
    trunk/qemu_socket.h
    trunk/savevm.c
    trunk/slirp/slirp.h
    trunk/sysemu.h
    trunk/tap-win32.c
    trunk/vl.c

Modified: trunk/block-raw-win32.c
===================================================================

block-raw-win32.c +1 -0
@@ -25,6 +25,7 @@
 #include "qemu-timer.h"
 #include "block_int.h"
 #include <assert.h>
+#include <windows.h>
 #include <winioctl.h>
 
 //#define WIN32_AIO

Modified: trunk/block.c
===================================================================

block.c +4 -0
@@ -40,6 +40,10 @@
 #endif
 #endif
 
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
 #define SECTOR_BITS 9
 #define SECTOR_SIZE (1 << SECTOR_BITS)
 

Modified: trunk/configure
===================================================================

configure +1 -0
@@ -590,6 +590,7 @@
     oss="no"
     linux_user="no"
     bsd_user="no"
+    OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
 fi
 
 if test ! -x "$(which cgcc 2>/dev/null)"; then

Modified: trunk/kqemu.c
===================================================================

kqemu.c +0 -1
@@ -19,7 +19,6 @@
  */
 #include "config.h"
 #ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winioctl.h>
 #else

Modified: trunk/net.c
===================================================================

net.c +1 -0
@@ -102,6 +102,7 @@
 #endif
 
 #ifdef _WIN32
+#include <windows.h>
 #include <malloc.h>
 #include <sys/timeb.h>
 #include <mmsystem.h>

Modified: trunk/osdep.c
===================================================================

osdep.c +0 -1
@@ -37,7 +37,6 @@
 #include "config-host.h"
 
 #ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #elif defined(HOST_BSD)
 #include <stdlib.h>

Modified: trunk/qemu-common.h
===================================================================

qemu-common.h +0 -6
@@ -2,12 +2,6 @@
 #ifndef QEMU_COMMON_H
 #define QEMU_COMMON_H
 
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#define WINVER 0x0501  /* needed for ipv6 bits */
-#include <windows.h>
-#endif
-
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 
 /* Hack around the mess dyngen-exec.h causes: We need QEMU_NORETURN in files that

Modified: trunk/qemu-img.c
===================================================================

qemu-img.c +0 -1
@@ -27,7 +27,6 @@
 #include <assert.h>
 
 #ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 

Modified: trunk/qemu_socket.h
===================================================================

qemu_socket.h +0 -2
@@ -3,8 +3,6 @@
 #define QEMU_SOCKET_H
 
 #ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#define WINVER 0x0501  /* needed for ipv6 bits */
 #include <windows.h>
 #include <winsock2.h>
 #include <ws2tcpip.h>

Modified: trunk/savevm.c
===================================================================

savevm.c +1 -0
@@ -71,6 +71,7 @@
 #endif
 
 #ifdef _WIN32
+#include <windows.h>
 #include <malloc.h>
 #include <sys/timeb.h>
 #include <mmsystem.h>

Modified: trunk/slirp/slirp.h
===================================================================

slirp/slirp.h +0 -1
@@ -29,7 +29,6 @@
 typedef uint64_t u_int64_t;
 typedef char *caddr_t;
 
-#define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 # include <winsock2.h>
 # include <ws2tcpip.h>

Modified: trunk/sysemu.h
===================================================================

sysemu.h +4 -0
@@ -4,6 +4,10 @@
 
 #include "qemu-common.h"
 
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
 /* vl.c */
 extern const char *bios_name;
 extern const char *bios_dir;

Modified: trunk/tap-win32.c
===================================================================

tap-win32.c +0 -1
@@ -30,7 +30,6 @@
 #include "net.h"
 #include "sysemu.h"
 #include <stdio.h>
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
 /* NOTE: PCIBus is redefined in winddk.h */

Modified: trunk/vl.c
===================================================================

vl.c +1 -0
@@ -103,6 +103,7 @@
 #endif
 
 #ifdef _WIN32
+#include <windows.h>
 #include <malloc.h>
 #include <sys/timeb.h>
 #include <mmsystem.h>