* [Qemu-devel] Windows build broken @ 2007-12-12 3:05 Balazs Attila-Mihaly (Cd-MaN) 2007-12-12 10:08 ` C.W. Betts 0 siblings, 1 reply; 11+ messages in thread From: Balazs Attila-Mihaly (Cd-MaN) @ 2007-12-12 3:05 UTC (permalink / raw) To: Qemu Devel Trying to build the current CVS Head with Mingw under windows, the result is the following error message: In file included from tap-win32.c:31: sysemu.h:125: error: syntax error before ';' token sysemu.h:137: error: syntax error before ',' token sysemu.h:138: error: syntax error before ')' token make: *** [tap-win32.o] Error 1 __________________________________________________________ Sent from Yahoo! - the World's favourite mail http://uk.mail.yahoo.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 3:05 [Qemu-devel] Windows build broken Balazs Attila-Mihaly (Cd-MaN) @ 2007-12-12 10:08 ` C.W. Betts 2007-12-12 10:41 ` Eduardo Felipe 0 siblings, 1 reply; 11+ messages in thread From: C.W. Betts @ 2007-12-12 10:08 UTC (permalink / raw) To: qemu-devel Same problem with cygwin. I think it's a problem with BlockInterfaceType not being correctly parsed on mingw-gcc for some odd reason. ----- Original Message ----- From: "Balazs Attila-Mihaly (Cd-MaN)" <x_at_y_or_z@yahoo.com> To: "Qemu Devel" <qemu-devel@nongnu.org> Sent: Tuesday, December 11, 2007 8:05 PM Subject: [Qemu-devel] Windows build broken Trying to build the current CVS Head with Mingw under windows, the result is the following error message: In file included from tap-win32.c:31: sysemu.h:125: error: syntax error before ';' token sysemu.h:137: error: syntax error before ',' token sysemu.h:138: error: syntax error before ')' token make: *** [tap-win32.o] Error 1 __________________________________________________________ Sent from Yahoo! - the World's favourite mail http://uk.mail.yahoo.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 10:08 ` C.W. Betts @ 2007-12-12 10:41 ` Eduardo Felipe 2007-12-12 15:27 ` C.W. Betts 0 siblings, 1 reply; 11+ messages in thread From: Eduardo Felipe @ 2007-12-12 10:41 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 517 bytes --] 2007/12/12, C.W. Betts <computers57@hotmail.com>: > > Same problem with cygwin. I think it's a problem with BlockInterfaceType > not being correctly parsed on mingw-gcc for some odd reason. Hi, I don't think it is related with BlockInterfaceType itself. The problem is to use "interface" as a variable or parameter name, which seems to be confused with a reserved keyword, type or something like that. I was able to compile with mingw changing that variable name and all its references along the code. Regards. [-- Attachment #2: Type: text/html, Size: 812 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 10:41 ` Eduardo Felipe @ 2007-12-12 15:27 ` C.W. Betts 2007-12-12 19:50 ` Eduardo Felipe 0 siblings, 1 reply; 11+ messages in thread From: C.W. Betts @ 2007-12-12 15:27 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 861 bytes --] Could you perhaps give a patch? I don't feel like going through and changing every instance of BlockInterfaceType to something else. ----- Original Message ----- From: Eduardo Felipe To: qemu-devel@nongnu.org Sent: Wednesday, December 12, 2007 3:41 AM Subject: Re: [Qemu-devel] Windows build broken 2007/12/12, C.W. Betts <computers57@hotmail.com>: Same problem with cygwin. I think it's a problem with BlockInterfaceType not being correctly parsed on mingw-gcc for some odd reason. Hi, I don't think it is related with BlockInterfaceType itself. The problem is to use "interface" as a variable or parameter name, which seems to be confused with a reserved keyword, type or something like that. I was able to compile with mingw changing that variable name and all its references along the code. Regards. [-- Attachment #2: Type: text/html, Size: 2051 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 15:27 ` C.W. Betts @ 2007-12-12 19:50 ` Eduardo Felipe 2007-12-12 20:54 ` Stefan Weil 0 siblings, 1 reply; 11+ messages in thread From: Eduardo Felipe @ 2007-12-12 19:50 UTC (permalink / raw) To: qemu-devel [-- Attachment #1.1: Type: text/plain, Size: 382 bytes --] 2007/12/12, C.W. Betts <computers57@hotmail.com>: > > Could you perhaps give a patch? I don't feel like going through and > changing every instance of BlockInterfaceType to something else. > Having a closer look I think the underlying problem is a name conflict with a #define in Mingw's header file basetyps.h, so renaming variables looks right to me. Patch attached. Regards, [-- Attachment #1.2: Type: text/html, Size: 732 bytes --] [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: rename_interface.patch --] [-- Type: text/x-patch; name=rename_interface.patch, Size: 4904 bytes --] *** sysemu.h --- sysemu.h --- sysemu.h 2 Dec 2007 04:51:08 -0000 1.2 +++ sysemu.h 12 Dec 2007 19:17:47 -0000 @@ -122,7 +122,7 @@ typedef struct DriveInfo { BlockDriverState *bdrv; - BlockInterfaceType interface; + BlockInterfaceType binterface; int bus; int unit; } DriveInfo; @@ -134,8 +134,8 @@ int nb_drives; DriveInfo drives_table[MAX_DRIVES+1]; -extern int drive_get_index(BlockInterfaceType interface, int bus, int unit); -extern int drive_get_max_bus(BlockInterfaceType interface); +extern int drive_get_index(BlockInterfaceType binterface, int bus, int unit); +extern int drive_get_max_bus(BlockInterfaceType binterface); /* serial ports */ *** vl.c --- vl.c --- vl.c 10 Dec 2007 20:00:10 -0000 1.378 +++ vl.c 12 Dec 2007 19:17:09 -0000 @@ -4811,14 +4811,14 @@ return nb_drives_opt++; } -int drive_get_index(BlockInterfaceType interface, int bus, int unit) +int drive_get_index(BlockInterfaceType binterface, int bus, int unit) { int index; /* seek interface, bus and unit */ for (index = 0; index < nb_drives; index++) - if (drives_table[index].interface == interface && + if (drives_table[index].binterface == binterface && drives_table[index].bus == bus && drives_table[index].unit == unit) return index; @@ -4826,14 +4826,14 @@ return -1; } -int drive_get_max_bus(BlockInterfaceType interface) +int drive_get_max_bus(BlockInterfaceType binterface) { int max_bus; int index; max_bus = -1; for (index = 0; index < nb_drives; index++) { - if(drives_table[index].interface == interface && + if(drives_table[index].binterface == binterface && drives_table[index].bus > max_bus) max_bus = drives_table[index].bus; } @@ -4846,7 +4846,7 @@ char file[1024]; char devname[128]; const char *mediastr = ""; - BlockInterfaceType interface; + BlockInterfaceType binterface; enum { MEDIA_DISK, MEDIA_CDROM } media; int bus_id, unit_id; int cyls, heads, secs, translation; @@ -4875,11 +4875,11 @@ !strcmp(machine->name, "SS-600MP") || !strcmp(machine->name, "versatilepb") || !strcmp(machine->name, "versatileab")) { - interface = IF_SCSI; + binterface = IF_SCSI; max_devs = MAX_SCSI_DEVS; strcpy(devname, "scsi"); } else { - interface = IF_IDE; + binterface = IF_IDE; max_devs = MAX_IDE_DEVS; strcpy(devname, "ide"); } @@ -4906,22 +4906,22 @@ if (get_param_value(buf, sizeof(buf), "if", str)) { strncpy(devname, buf, sizeof(devname)); if (!strcmp(buf, "ide")) { - interface = IF_IDE; + binterface = IF_IDE; max_devs = MAX_IDE_DEVS; } else if (!strcmp(buf, "scsi")) { - interface = IF_SCSI; + binterface = IF_SCSI; max_devs = MAX_SCSI_DEVS; } else if (!strcmp(buf, "floppy")) { - interface = IF_FLOPPY; + binterface = IF_FLOPPY; max_devs = 0; } else if (!strcmp(buf, "pflash")) { - interface = IF_PFLASH; + binterface = IF_PFLASH; max_devs = 0; } else if (!strcmp(buf, "mtd")) { - interface = IF_MTD; + binterface = IF_MTD; max_devs = 0; } else if (!strcmp(buf, "sd")) { - interface = IF_SD; + binterface = IF_SD; max_devs = 0; } else { fprintf(stderr, "qemu: '%s' unsupported bus type '%s'\n", str, buf); @@ -5036,7 +5036,7 @@ if (unit_id == -1) { unit_id = 0; - while (drive_get_index(interface, bus_id, unit_id) != -1) { + while (drive_get_index(binterface, bus_id, unit_id) != -1) { unit_id++; if (max_devs && unit_id >= max_devs) { unit_id -= max_devs; @@ -5057,23 +5057,23 @@ * ignore multiple definitions */ - if (drive_get_index(interface, bus_id, unit_id) != -1) + if (drive_get_index(binterface, bus_id, unit_id) != -1) return 0; /* init */ - if (interface == IF_IDE || interface == IF_SCSI) + if (binterface == IF_IDE || binterface == IF_SCSI) mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd"; snprintf(buf, sizeof(buf), max_devs ? "%1$s%4$i%2$s%3$i" : "%s%s%i", devname, mediastr, unit_id, bus_id); bdrv = bdrv_new(buf); drives_table[nb_drives].bdrv = bdrv; - drives_table[nb_drives].interface = interface; + drives_table[nb_drives].binterface = binterface; drives_table[nb_drives].bus = bus_id; drives_table[nb_drives].unit = unit_id; nb_drives++; - switch(interface) { + switch(binterface) { case IF_IDE: case IF_SCSI: switch(media) { ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 19:50 ` Eduardo Felipe @ 2007-12-12 20:54 ` Stefan Weil 2007-12-13 0:47 ` JonY 0 siblings, 1 reply; 11+ messages in thread From: Stefan Weil @ 2007-12-12 20:54 UTC (permalink / raw) To: qemu-devel basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so you can avoid it like this: #define WIN32_LEAN_AND_MEAN #include <windows.h> WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h and increases compilation speed. And you don't have to rename variables like interface :-) Regards, Stefan Eduardo Felipe schrieb: > > 2007/12/12, C.W. Betts <computers57@hotmail.com > <mailto:computers57@hotmail.com>>: > > Could you perhaps give a patch? I don't feel like going through > and changing every instance of BlockInterfaceType to something else. > > > Having a closer look I think the underlying problem is a name conflict > with a #define in Mingw's header file basetyps.h, so renaming > variables looks right to me. Patch attached. > > Regards, > > > > > ------------------------------------------------------------------------ > > > *** sysemu.h > --- sysemu.h > --- sysemu.h 2 Dec 2007 04:51:08 -0000 1.2 > +++ sysemu.h 12 Dec 2007 19:17:47 -0000 > @@ -122,7 +122,7 @@ > > typedef struct DriveInfo { > BlockDriverState *bdrv; > - BlockInterfaceType interface; > + BlockInterfaceType binterface; > int bus; > int unit; > } DriveInfo; > @@ -134,8 +134,8 @@ > int nb_drives; > DriveInfo drives_table[MAX_DRIVES+1]; > > -extern int drive_get_index(BlockInterfaceType interface, int bus, int > unit); > -extern int drive_get_max_bus(BlockInterfaceType interface); > +extern int drive_get_index(BlockInterfaceType binterface, int bus, > int unit); > +extern int drive_get_max_bus(BlockInterfaceType binterface); > > /* serial ports */ > > > *** vl.c > --- vl.c > --- vl.c 10 Dec 2007 20:00:10 -0000 1.378 > +++ vl.c 12 Dec 2007 19:17:09 -0000 > @@ -4811,14 +4811,14 @@ > return nb_drives_opt++; > } > > -int drive_get_index(BlockInterfaceType interface, int bus, int unit) > +int drive_get_index(BlockInterfaceType binterface, int bus, int unit) > { > int index; > > /* seek interface, bus and unit */ > > for (index = 0; index < nb_drives; index++) > - if (drives_table[index].interface == interface && > + if (drives_table[index].binterface == binterface && > drives_table[index].bus == bus && > drives_table[index].unit == unit) > return index; > @@ -4826,14 +4826,14 @@ > return -1; > } > > -int drive_get_max_bus(BlockInterfaceType interface) > +int drive_get_max_bus(BlockInterfaceType binterface) > { > int max_bus; > int index; > > max_bus = -1; > for (index = 0; index < nb_drives; index++) { > - if(drives_table[index].interface == interface && > + if(drives_table[index].binterface == binterface && > drives_table[index].bus > max_bus) > max_bus = drives_table[index].bus; > } > @@ -4846,7 +4846,7 @@ > char file[1024]; > char devname[128]; > const char *mediastr = ""; > - BlockInterfaceType interface; > + BlockInterfaceType binterface; > enum { MEDIA_DISK, MEDIA_CDROM } media; > int bus_id, unit_id; > int cyls, heads, secs, translation; > @@ -4875,11 +4875,11 @@ > !strcmp(machine->name, "SS-600MP") || > !strcmp(machine->name, "versatilepb") || > !strcmp(machine->name, "versatileab")) { > - interface = IF_SCSI; > + binterface = IF_SCSI; > max_devs = MAX_SCSI_DEVS; > strcpy(devname, "scsi"); > } else { > - interface = IF_IDE; > + binterface = IF_IDE; > max_devs = MAX_IDE_DEVS; > strcpy(devname, "ide"); > } > @@ -4906,22 +4906,22 @@ > if (get_param_value(buf, sizeof(buf), "if", str)) { > strncpy(devname, buf, sizeof(devname)); > if (!strcmp(buf, "ide")) { > - interface = IF_IDE; > + binterface = IF_IDE; > max_devs = MAX_IDE_DEVS; > } else if (!strcmp(buf, "scsi")) { > - interface = IF_SCSI; > + binterface = IF_SCSI; > max_devs = MAX_SCSI_DEVS; > } else if (!strcmp(buf, "floppy")) { > - interface = IF_FLOPPY; > + binterface = IF_FLOPPY; > max_devs = 0; > } else if (!strcmp(buf, "pflash")) { > - interface = IF_PFLASH; > + binterface = IF_PFLASH; > max_devs = 0; > } else if (!strcmp(buf, "mtd")) { > - interface = IF_MTD; > + binterface = IF_MTD; > max_devs = 0; > } else if (!strcmp(buf, "sd")) { > - interface = IF_SD; > + binterface = IF_SD; > max_devs = 0; > } else { > fprintf(stderr, "qemu: '%s' unsupported bus type '%s'\n", str, buf); > @@ -5036,7 +5036,7 @@ > > if (unit_id == -1) { > unit_id = 0; > - while (drive_get_index(interface, bus_id, unit_id) != -1) { > + while (drive_get_index(binterface, bus_id, unit_id) != -1) { > unit_id++; > if (max_devs && unit_id >= max_devs) { > unit_id -= max_devs; > @@ -5057,23 +5057,23 @@ > * ignore multiple definitions > */ > > - if (drive_get_index(interface, bus_id, unit_id) != -1) > + if (drive_get_index(binterface, bus_id, unit_id) != -1) > return 0; > > /* init */ > > - if (interface == IF_IDE || interface == IF_SCSI) > + if (binterface == IF_IDE || binterface == IF_SCSI) > mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd"; > snprintf(buf, sizeof(buf), max_devs ? "%1$s%4$i%2$s%3$i" : "%s%s%i", > devname, mediastr, unit_id, bus_id); > bdrv = bdrv_new(buf); > drives_table[nb_drives].bdrv = bdrv; > - drives_table[nb_drives].interface = interface; > + drives_table[nb_drives].binterface = binterface; > drives_table[nb_drives].bus = bus_id; > drives_table[nb_drives].unit = unit_id; > nb_drives++; > > - switch(interface) { > + switch(binterface) { > case IF_IDE: > case IF_SCSI: > switch(media) { > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] Windows build broken 2007-12-12 20:54 ` Stefan Weil @ 2007-12-13 0:47 ` JonY 2007-12-13 20:20 ` [Qemu-devel][Patch] " Stefan Weil 0 siblings, 1 reply; 11+ messages in thread From: JonY @ 2007-12-13 0:47 UTC (permalink / raw) To: qemu-devel Stefan Weil wrote: > basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so > you can avoid it like this: > > #define WIN32_LEAN_AND_MEAN > #include <windows.h> > > WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h > and increases compilation speed. And you don't have to rename > variables like interface :-) > > Regards, > Stefan > > Eduardo Felipe schrieb: >> 2007/12/12, C.W. Betts <computers57@hotmail.com >> <mailto:computers57@hotmail.com>>: >> >> Could you perhaps give a patch? I don't feel like going through >> and changing every instance of BlockInterfaceType to something else. >> >> >> Having a closer look I think the underlying problem is a name conflict >> with a #define in Mingw's header file basetyps.h, so renaming >> variables looks right to me. Patch attached. >> >> Regards, >> >> Hi, I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks dsound. Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel][Patch] Windows build broken 2007-12-13 0:47 ` JonY @ 2007-12-13 20:20 ` Stefan Weil 2007-12-14 1:39 ` JonY 0 siblings, 1 reply; 11+ messages in thread From: Stefan Weil @ 2007-12-13 20:20 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1291 bytes --] Here is a patch using WIN32_LEAN_AND_MEAN which tries not to break dsound (and vl.c). I could only test it using cross compilation from Linux, so please send comments. Patch description: * add WIN32_LEAN_AND_MEAN to all inclusions of windows.h * remove windows.h from vl.c (it is already included otherwise) * add mmsystem.h to vl.c and dsoundaudio.c (they need it and got it from windows.h) * fixed indentation in vl.c (wrong indentation was caused by an earlier patch from me) It will be difficult to avoid using variable names like "interface" in the future, so I still think using a minimal set of includes is the better (and faster) solution. Anyway, Windows users need a working solution, so it would be nice if one of these patches could be applied to CVS HEAD. Thank you. Stefan JonY schrieb: > Stefan Weil wrote: >> basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so >> you can avoid it like this: >> >> #define WIN32_LEAN_AND_MEAN >> #include <windows.h> >> >> WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h >> and increases compilation speed. And you don't have to rename >> variables like interface :-) >> >> Regards, >> Stefan > > Hi, > > I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks > dsound. > > Thanks. > > > [-- Attachment #2: windows.patch --] [-- Type: text/x-diff, Size: 4467 bytes --] Index: qemu_socket.h =================================================================== RCS file: /sources/qemu/qemu/qemu_socket.h,v retrieving revision 1.2 diff -u -r1.2 qemu_socket.h --- qemu_socket.h 21 Dec 2006 19:46:43 -0000 1.2 +++ qemu_socket.h 13 Dec 2007 20:09:04 -0000 @@ -3,7 +3,7 @@ #define QEMU_SOCKET_H #ifdef _WIN32 - +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> Index: osdep.c =================================================================== RCS file: /sources/qemu/qemu/osdep.c,v retrieving revision 1.20 diff -u -r1.20 osdep.c --- osdep.c 18 Nov 2007 01:44:35 -0000 1.20 +++ osdep.c 13 Dec 2007 20:09:05 -0000 @@ -37,6 +37,7 @@ #include "sysemu.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #elif defined(_BSD) #include <stdlib.h> Index: vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.379 diff -u -r1.379 vl.c --- vl.c 11 Dec 2007 23:23:51 -0000 1.379 +++ vl.c 13 Dec 2007 20:09:07 -0000 @@ -109,7 +109,7 @@ #ifdef _WIN32 #include <malloc.h> #include <sys/timeb.h> -#include <windows.h> +#include <mmsystem.h> #define getopt_long_only getopt_long #define memalign(align, size) malloc(size) #endif @@ -8937,7 +8937,7 @@ s->down_script[0]) launch_script(s->down_script, ifname, s->fd); } - } + } } #endif return 0; Index: tap-win32.c =================================================================== RCS file: /sources/qemu/qemu/tap-win32.c,v retrieving revision 1.7 diff -u -r1.7 tap-win32.c --- tap-win32.c 17 Nov 2007 17:14:38 -0000 1.7 +++ tap-win32.c 13 Dec 2007 20:09:07 -0000 @@ -30,6 +30,7 @@ #include "net.h" #include "sysemu.h" #include <stdio.h> +#define WIN32_LEAN_AND_MEAN #include <windows.h> /* NOTE: PCIBus is redefined in winddk.h */ Index: qemu-common.h =================================================================== RCS file: /sources/qemu/qemu/qemu-common.h,v retrieving revision 1.3 diff -u -r1.3 qemu-common.h --- qemu-common.h 19 Nov 2007 00:38:33 -0000 1.3 +++ qemu-common.h 13 Dec 2007 20:09:07 -0000 @@ -28,6 +28,7 @@ #endif #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #define fsync _commit #define lseek _lseeki64 Index: exec.c =================================================================== RCS file: /sources/qemu/qemu/exec.c,v retrieving revision 1.119 diff -u -r1.119 exec.c --- exec.c 12 Dec 2007 01:16:22 -0000 1.119 +++ exec.c 13 Dec 2007 20:09:08 -0000 @@ -19,6 +19,7 @@ */ #include "config.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #else #include <sys/types.h> Index: qemu-img.c =================================================================== RCS file: /sources/qemu/qemu/qemu-img.c,v retrieving revision 1.25 diff -u -r1.25 qemu-img.c --- qemu-img.c 11 Nov 2007 03:33:13 -0000 1.25 +++ qemu-img.c 13 Dec 2007 20:09:09 -0000 @@ -26,6 +26,7 @@ #include <assert.h> #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #endif Index: kqemu.c =================================================================== RCS file: /sources/qemu/qemu/kqemu.c,v retrieving revision 1.19 diff -u -r1.19 kqemu.c --- kqemu.c 17 Sep 2007 08:09:44 -0000 1.19 +++ kqemu.c 13 Dec 2007 20:09:09 -0000 @@ -19,6 +19,7 @@ */ #include "config.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winioctl.h> #else Index: audio/dsoundaudio.c =================================================================== RCS file: /sources/qemu/qemu/audio/dsoundaudio.c,v retrieving revision 1.4 diff -u -r1.4 dsoundaudio.c --- audio/dsoundaudio.c 17 Nov 2007 17:35:54 -0000 1.4 +++ audio/dsoundaudio.c 13 Dec 2007 20:09:09 -0000 @@ -32,7 +32,9 @@ #define AUDIO_CAP "dsound" #include "audio_int.h" +#define WIN32_LEAN_AND_MEAN #include <windows.h> +#include <mmsystem.h> #include <objbase.h> #include <dsound.h> Index: slirp/slirp.h =================================================================== RCS file: /sources/qemu/qemu/slirp/slirp.h,v retrieving revision 1.14 diff -u -r1.14 slirp.h --- slirp/slirp.h 7 Nov 2007 19:27:18 -0000 1.14 +++ slirp/slirp.h 13 Dec 2007 20:09:09 -0000 @@ -29,6 +29,7 @@ typedef uint64_t u_int64_t; typedef char *caddr_t; +#define WIN32_LEAN_AND_MEAN # include <windows.h> # include <winsock2.h> # include <sys/timeb.h> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel][Patch] Windows build broken 2007-12-13 20:20 ` [Qemu-devel][Patch] " Stefan Weil @ 2007-12-14 1:39 ` JonY 2007-12-14 19:05 ` Stefan Weil 0 siblings, 1 reply; 11+ messages in thread From: JonY @ 2007-12-14 1:39 UTC (permalink / raw) To: qemu-devel Stefan Weil wrote: > Here is a patch using WIN32_LEAN_AND_MEAN which tries not to break > dsound (and vl.c). I could only test it using cross compilation from Linux, > so please send comments. > > Patch description: > * add WIN32_LEAN_AND_MEAN to all inclusions of windows.h > * remove windows.h from vl.c (it is already included otherwise) > * add mmsystem.h to vl.c and dsoundaudio.c (they need it and got it from > windows.h) > * fixed indentation in vl.c (wrong indentation was caused by an earlier > patch from me) > > It will be difficult to avoid using variable names like "interface" in the > future, so I still think using a minimal set of includes is the better > (and faster) solution. > > Anyway, Windows users need a working solution, so it would be nice if one > of these patches could be applied to CVS HEAD. > > Thank you. > Stefan > > JonY schrieb: >> Stefan Weil wrote: >>> basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so >>> you can avoid it like this: >>> >>> #define WIN32_LEAN_AND_MEAN >>> #include <windows.h> >>> >>> WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h >>> and increases compilation speed. And you don't have to rename >>> variables like interface :-) >>> >>> Regards, >>> Stefan >> Hi, >> >> I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks >> dsound. >> >> Thanks. >> >> >> > Ok, this patch works as intended. Thanks for the patch! Slightly off topic, but still on Windows builds broken. For some odd reason, dyngen-exec.h is always conflicting with stdint.h(?!!) for me. Can somebody explain why the typedefs are in dyngen-exec.h? Mingw does not have ffs, localtime_r, gmtime_r, which breaks when compiling some files. I propose adding the following for *_r functions on mingw hosts. #define localtime_r(x, y) memcpy(y, localtime(x), sizeof(y)) #define gmtime_r(x, y) memcpy(y, gmtime(x), sizeof(y)) There are many implementations of ffs(), but I'm unsure what it does :( ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel][Patch] Windows build broken 2007-12-14 1:39 ` JonY @ 2007-12-14 19:05 ` Stefan Weil 2007-12-16 13:54 ` Paul Brook 0 siblings, 1 reply; 11+ messages in thread From: Stefan Weil @ 2007-12-14 19:05 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1053 bytes --] JonY schrieb: > > Ok, this patch works as intended. Thanks for the patch! > > Slightly off topic, but still on Windows builds broken. > > For some odd reason, dyngen-exec.h is always conflicting with > stdint.h(?!!) for me. Can somebody explain why the typedefs are in > dyngen-exec.h? > > Mingw does not have ffs, localtime_r, gmtime_r, which breaks when > compiling some files. > > I propose adding the following for *_r functions on mingw hosts. > #define localtime_r(x, y) memcpy(y, localtime(x), sizeof(y)) > #define gmtime_r(x, y) memcpy(y, gmtime(x), sizeof(y)) > > There are many implementations of ffs(), but I'm unsure what it does :( >From the man page: ffs - find first bit set in a word Typically, gcc provides a built-in function ffs, so there is no need to get an implementation for Windows. The missing prototype just gives a warning. I send here a patch which adds the prototype to osdep.h (only for Win32). gmtime_r is really missing (see hw/omap.c). This was already discussed in another thread, but not solved up to now. Stefan [-- Attachment #2: osdep.patch --] [-- Type: text/x-diff, Size: 408 bytes --] Index: osdep.h =================================================================== RCS file: /sources/qemu/qemu/osdep.h,v retrieving revision 1.11 diff -u -r1.11 osdep.h --- osdep.h 19 Nov 2007 00:38:33 -0000 1.11 +++ osdep.h 14 Dec 2007 19:03:49 -0000 @@ -56,6 +56,7 @@ int qemu_create_pidfile(const char *filename); #ifdef _WIN32 +int ffs(int i); typedef struct { long tv_sec; long tv_usec; ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel][Patch] Windows build broken 2007-12-14 19:05 ` Stefan Weil @ 2007-12-16 13:54 ` Paul Brook 0 siblings, 0 replies; 11+ messages in thread From: Paul Brook @ 2007-12-16 13:54 UTC (permalink / raw) To: qemu-devel > Typically, gcc provides a built-in function ffs Actually, not it doesn't. As with many other standard functions, gcc will sometimes optimize it, maybe expanding to inline code. However there's always the possibility of falling back to the standard C library implementation. Paul ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-12-16 13:55 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-12 3:05 [Qemu-devel] Windows build broken Balazs Attila-Mihaly (Cd-MaN) 2007-12-12 10:08 ` C.W. Betts 2007-12-12 10:41 ` Eduardo Felipe 2007-12-12 15:27 ` C.W. Betts 2007-12-12 19:50 ` Eduardo Felipe 2007-12-12 20:54 ` Stefan Weil 2007-12-13 0:47 ` JonY 2007-12-13 20:20 ` [Qemu-devel][Patch] " Stefan Weil 2007-12-14 1:39 ` JonY 2007-12-14 19:05 ` Stefan Weil 2007-12-16 13:54 ` Paul Brook
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).