* [Qemu-devel] [RFC] mingw32/64 fixes
@ 2015-02-05 15:15 Juan Quintela
2015-02-05 15:37 ` Daniel P. Berrange
0 siblings, 1 reply; 2+ messages in thread
From: Juan Quintela @ 2015-02-05 15:15 UTC (permalink / raw)
To: qemu-devel
Hi
In fedora 21 when crosscompiling for windows I get that this functions
are already defined. As they are declared there, I guess than in
older complilers they weren't there. Is there a portable way to get
happy both old and new compilers?
Once there, the only other error that I got is this, but I think that
this is a bug on the compiler
(w32 have qemu configured for cross-compiling for windows 32 bit, w64 for 64).
The problem is with the assert() on that function.
assert(region_num < PCI_NUM_REGIONS);
If I comment that assert, change it to ((unsigned)PCI_NUM_REGIONS) or
(PCI_NUM_REGIONS -1) the error go away.
Notice that there are other functions on that file that use the
same/similar asserts on a different function that also access
io_regions give no errors/warnings.
Any idea?
()amit-pull *)$ make -j5 -C /scratch/tmp/next/w32/
make: Entering directory '/scratch/tmp/next/w32'
CC hw/pci/pci.o
/mnt/kvm/qemu/next/hw/pci/pci.c: In function 'pci_register_bar':
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
r = &pci_dev->io_regions[region_num];
^
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors
/mnt/kvm/qemu/next/rules.mak:57: recipe for target 'hw/pci/pci.o' failed
make: *** [hw/pci/pci.o] Error 1
make: Leaving directory '/scratch/tmp/next/w32'
(amit-pull)$ make -j5 -C /scratch/tmp/next/w64/
make: Entering directory '/scratch/tmp/next/w64'
CC hw/pci/pci.o
/mnt/kvm/qemu/next/hw/pci/pci.c: In function 'pci_register_bar':
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
r = &pci_dev->io_regions[region_num];
^
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
/mnt/kvm/qemu/next/hw/pci/pci.c:932:29: error: array subscript is above array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors
/mnt/kvm/qemu/next/rules.mak:57: recipe for target 'hw/pci/pci.o' failed
make: *** [hw/pci/pci.o] Error 1
make: Leaving directory '/scratch/tmp/next/w64'
Later, Juan.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
include/sysemu/os-win32.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index af3fbc4..7f39c42 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -75,14 +75,6 @@
/* Declaration of ffs() is missing in MinGW's strings.h. */
int ffs(int i);
-/* Missing POSIX functions. Don't use MinGW-w64 macros. */
-#undef gmtime_r
-struct tm *gmtime_r(const time_t *timep, struct tm *result);
-#undef localtime_r
-struct tm *localtime_r(const time_t *timep, struct tm *result);
-
-char *strtok_r(char *str, const char *delim, char **saveptr);
-
static inline void os_setup_signal_handling(void) {}
static inline void os_daemonize(void) {}
static inline void os_setup_post(void) {}
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [RFC] mingw32/64 fixes
2015-02-05 15:15 [Qemu-devel] [RFC] mingw32/64 fixes Juan Quintela
@ 2015-02-05 15:37 ` Daniel P. Berrange
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrange @ 2015-02-05 15:37 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel
On Thu, Feb 05, 2015 at 04:15:50PM +0100, Juan Quintela wrote:
> Hi
>
> In fedora 21 when crosscompiling for windows I get that this functions
> are already defined. As they are declared there, I guess than in
> older complilers they weren't there. Is there a portable way to get
> happy both old and new compilers?
[snip]
> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
> index af3fbc4..7f39c42 100644
> --- a/include/sysemu/os-win32.h
> +++ b/include/sysemu/os-win32.h
> @@ -75,14 +75,6 @@
> /* Declaration of ffs() is missing in MinGW's strings.h. */
> int ffs(int i);
>
> -/* Missing POSIX functions. Don't use MinGW-w64 macros. */
> -#undef gmtime_r
> -struct tm *gmtime_r(const time_t *timep, struct tm *result);
> -#undef localtime_r
> -struct tm *localtime_r(const time_t *timep, struct tm *result);
> -
> -char *strtok_r(char *str, const char *delim, char **saveptr);
> -
> static inline void os_setup_signal_handling(void) {}
> static inline void os_daemonize(void) {}
> static inline void os_setup_post(void) {}
This is presumably due to the historic bad namespace pollution in Mingw64
winpthreads. They stuffed a bunch of macros in pthread.h for things
like gmtime_r, localtime_r and friends. This was certainly true in the
mingw64 version that shipped with Fedora 20, but in Fedora 21 that bad
code in pthread.h has gone away. Presumably this change is what has
caused you trouble building.
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] 2+ messages in thread
end of thread, other threads:[~2015-02-05 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 15:15 [Qemu-devel] [RFC] mingw32/64 fixes Juan Quintela
2015-02-05 15:37 ` Daniel P. Berrange
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).