Commit 49dc768d4c579298d56777348422ebdca565a3ef

Authored by aliguori
1 parent 2734c703

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.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6783 c046a42c-6fe2-441c-8c8c-71466251a162
block-raw-win32.c
... ... @@ -25,6 +25,7 @@
25 25 #include "qemu-timer.h"
26 26 #include "block_int.h"
27 27 #include <assert.h>
  28 +#include <windows.h>
28 29 #include <winioctl.h>
29 30  
30 31 //#define WIN32_AIO
... ...
... ... @@ -40,6 +40,10 @@
40 40 #endif
41 41 #endif
42 42  
  43 +#ifdef _WIN32
  44 +#include <windows.h>
  45 +#endif
  46 +
43 47 #define SECTOR_BITS 9
44 48 #define SECTOR_SIZE (1 << SECTOR_BITS)
45 49  
... ...
configure
... ... @@ -590,6 +590,7 @@ if test &quot;$mingw32&quot; = &quot;yes&quot; ; then
590 590 oss="no"
591 591 linux_user="no"
592 592 bsd_user="no"
  593 + OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
593 594 fi
594 595  
595 596 if test ! -x "$(which cgcc 2>/dev/null)"; then
... ...
... ... @@ -19,7 +19,6 @@
19 19 */
20 20 #include "config.h"
21 21 #ifdef _WIN32
22   -#define WIN32_LEAN_AND_MEAN
23 22 #include <windows.h>
24 23 #include <winioctl.h>
25 24 #else
... ...
... ... @@ -102,6 +102,7 @@
102 102 #endif
103 103  
104 104 #ifdef _WIN32
  105 +#include <windows.h>
105 106 #include <malloc.h>
106 107 #include <sys/timeb.h>
107 108 #include <mmsystem.h>
... ...
... ... @@ -37,7 +37,6 @@
37 37 #include "config-host.h"
38 38  
39 39 #ifdef _WIN32
40   -#define WIN32_LEAN_AND_MEAN
41 40 #include <windows.h>
42 41 #elif defined(HOST_BSD)
43 42 #include <stdlib.h>
... ...
qemu-common.h
... ... @@ -2,12 +2,6 @@
2 2 #ifndef QEMU_COMMON_H
3 3 #define QEMU_COMMON_H
4 4  
5   -#ifdef _WIN32
6   -#define WIN32_LEAN_AND_MEAN
7   -#define WINVER 0x0501 /* needed for ipv6 bits */
8   -#include <windows.h>
9   -#endif
10   -
11 5 #define QEMU_NORETURN __attribute__ ((__noreturn__))
12 6  
13 7 /* Hack around the mess dyngen-exec.h causes: We need QEMU_NORETURN in files that
... ...
qemu-img.c
... ... @@ -27,7 +27,6 @@
27 27 #include <assert.h>
28 28  
29 29 #ifdef _WIN32
30   -#define WIN32_LEAN_AND_MEAN
31 30 #include <windows.h>
32 31 #endif
33 32  
... ...
qemu_socket.h
... ... @@ -3,8 +3,6 @@
3 3 #define QEMU_SOCKET_H
4 4  
5 5 #ifdef _WIN32
6   -#define WIN32_LEAN_AND_MEAN
7   -#define WINVER 0x0501 /* needed for ipv6 bits */
8 6 #include <windows.h>
9 7 #include <winsock2.h>
10 8 #include <ws2tcpip.h>
... ...
savevm.c
... ... @@ -71,6 +71,7 @@
71 71 #endif
72 72  
73 73 #ifdef _WIN32
  74 +#include <windows.h>
74 75 #include <malloc.h>
75 76 #include <sys/timeb.h>
76 77 #include <mmsystem.h>
... ...
slirp/slirp.h
... ... @@ -29,7 +29,6 @@ typedef uint32_t u_int32_t;
29 29 typedef uint64_t u_int64_t;
30 30 typedef char *caddr_t;
31 31  
32   -#define WIN32_LEAN_AND_MEAN
33 32 # include <windows.h>
34 33 # include <winsock2.h>
35 34 # include <ws2tcpip.h>
... ...
sysemu.h
... ... @@ -4,6 +4,10 @@
4 4  
5 5 #include "qemu-common.h"
6 6  
  7 +#ifdef _WIN32
  8 +#include <windows.h>
  9 +#endif
  10 +
7 11 /* vl.c */
8 12 extern const char *bios_name;
9 13 extern const char *bios_dir;
... ...
tap-win32.c
... ... @@ -30,7 +30,6 @@
30 30 #include "net.h"
31 31 #include "sysemu.h"
32 32 #include <stdio.h>
33   -#define WIN32_LEAN_AND_MEAN
34 33 #include <windows.h>
35 34  
36 35 /* NOTE: PCIBus is redefined in winddk.h */
... ...
... ... @@ -103,6 +103,7 @@
103 103 #endif
104 104  
105 105 #ifdef _WIN32
  106 +#include <windows.h>
106 107 #include <malloc.h>
107 108 #include <sys/timeb.h>
108 109 #include <mmsystem.h>
... ...