qemu/util
Daniel P. Berrange 4d9310f427 oslib-win32: only provide localtime_r/gmtime_r if missing
The oslib-win32 file currently provides a localtime_r and
gmtime_r replacement unconditionally. Some versions of
Mingw-w64 would provide crude macros for localtime_r/gmtime_r
which QEMU takes care to disable. Latest versions of Mingw-w64
now provide actual functions for localtime_r/gmtime_r, but
with a twist that you have to include unistd.h or pthread.h
before including time.h.  By luck some files in QEMU have
such an include order, resulting in compile errors:

  CC    util/osdep.o
In file included from include/qemu-common.h:48:0,
                 from util/osdep.c:48:
include/sysemu/os-win32.h:77:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
 struct tm *gmtime_r(const time_t *timep, struct tm *result);
            ^
In file included from include/qemu-common.h:35:0,
                 from util/osdep.c:48:
/usr/i686-w64-mingw32/sys-root/mingw/include/time.h:272:107: note: previous definition of 'gmtime_r' was here
In file included from include/qemu-common.h:48:0,
                 from util/osdep.c:48:
include/sysemu/os-win32.h:79:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
 struct tm *localtime_r(const time_t *timep, struct tm *result);
            ^
In file included from include/qemu-common.h:35:0,
                 from util/osdep.c:48:
/usr/i686-w64-mingw32/sys-root/mingw/include/time.h:269:107: note: previous definition of 'localtime_r' was here

This change adds a configure test to see if localtime_r
exits, and only enables the QEMU impl if missing. We also
re-arrange qemu-common.h try attempt to guarantee that all
source files get unistd.h before time.h and thus see the
localtime_r/gmtime_r defs.

[sw: Use "official" spellings for Mingw-w64, MinGW in comments.]
[sw: Terminate sentences with a dot in comments.]

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-24 21:13:49 +02:00
..
acl.c acl: fix memory leak 2014-11-17 11:48:56 +01:00
bitmap.c maint: remove / fix many doubled words 2015-09-11 10:21:38 +03:00
bitops.c
compatfd.c util: Remove unused functions 2015-04-30 16:05:48 +03:00
crc32c.c
cutils.c * Support for jemalloc 2015-09-14 16:13:16 +01:00
envlist.c utils: drop strtok_r from envlist_parse 2015-02-16 16:20:02 -06:00
error.c error: New error_fatal 2015-09-18 14:38:08 +02:00
event_notifier-posix.c event-notifier: Always return 0 for posix implementation 2015-06-12 13:26:21 +01:00
event_notifier-win32.c
fifo8.c
getauxval.c
hbitmap.c util/hbitmap: Add an API to reset all set bits in hbitmap 2015-06-23 15:06:16 +01:00
hexdump.c
host-utils.c util: Don't link host-utils.o if it's empty 2014-09-09 13:13:05 +02:00
id.c util: Emancipate id_wellformed() from QemuOpts 2014-10-03 10:30:33 +01:00
iov.c iov: don't touch iov in iov_send_recv() 2015-06-23 16:05:34 +01:00
Makefile.objs crypto: move built-in AES implementation into crypto/ 2015-07-07 12:04:13 +02:00
module.c
notify.c
osdep.c qerror: Move #include out of qerror.h 2015-06-22 18:20:40 +02:00
oslib-posix.c util: allow \n to terminate password input 2015-05-22 17:08:01 +02:00
oslib-win32.c oslib-win32: only provide localtime_r/gmtime_r if missing 2015-09-24 21:13:49 +02:00
path.c
qemu-config.c Include qapi/qmp/qerror.h exactly where needed 2015-06-22 18:20:41 +02:00
qemu-error.c error: only prepend timestamp on stderr 2015-09-18 14:34:39 +02:00
qemu-openpty.c
qemu-option.c hmp: Allow for error message hints on HMP 2015-09-18 14:34:39 +02:00
qemu-progress.c
qemu-sockets.c util/qemu-sockets: improve ai_flag hints for ipv6 hosts 2015-06-23 20:23:39 +03:00
qemu-thread-posix.c * Support for jemalloc 2015-09-14 16:13:16 +01:00
qemu-thread-win32.c qemu-thread: add a fast path to the Win32 QemuEvent 2015-09-24 20:52:28 +02:00
qemu-timer-common.c
rcu.c Revert "rcu: init rcu_registry_lock after fork" 2015-09-16 17:33:32 +02:00
readline.c
rfifolock.c
throttle.c throttle: refuse bps_max/iops_max without bps/iops 2015-08-05 12:53:48 +01:00
unicode.c
uri.c util/uri: Add overflow check to rfc3986_parse_port 2015-03-18 12:05:31 +01:00