From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeOGC-0000Bd-LT for qemu-devel@nongnu.org; Tue, 22 Sep 2015 10:09:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeOG9-0000Ff-L9 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 10:09:32 -0400 Received: from mx2.parallels.com ([199.115.105.18]:52671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeOG9-0008PV-GD for qemu-devel@nongnu.org; Tue, 22 Sep 2015 10:09:29 -0400 References: <1442928883-4119-1-git-send-email-mst@redhat.com> <20150922134804.GW28888@redhat.com> From: "Denis V. Lunev" Message-ID: <56016107.7040503@openvz.org> Date: Tue, 22 Sep 2015 17:09:11 +0300 MIME-Version: 1.0 In-Reply-To: <20150922134804.GW28888@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] mingw: fix build on Fedora 22 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , "Michael S. Tsirkin" Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , qemu-devel@nongnu.org, Stefan Hajnoczi , Stefan Weil , Igor Mammedov On 09/22/2015 04:48 PM, Daniel P. Berrange wrote: > On Tue, Sep 22, 2015 at 04:38:31PM +0300, Michael S. Tsirkin wrote: >> mingw on Fedora 22 replaces localtime_r and gmtime_r >> macros with posix compliant functions in time.h. >> >> These conflict with QEMU supplied ones. >> >> Detect this and avoid overriding them. >> >> We also need to define POSIX_C_SOURCE before including >> time.h for the first time, to make sure these >> are available to all users. >> >> Reported-by: Stefan Hajnoczi >> Cc: Stefan Weil >> Signed-off-by: Michael S. Tsirkin >> --- >> include/qemu/osdep.h | 1 + >> include/sysemu/os-win32.h | 6 ++++++ >> util/oslib-win32.c | 4 ++++ >> 3 files changed, 11 insertions(+) >> >> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h >> index ab3c876..9920ac3 100644 >> --- a/include/qemu/osdep.h >> +++ b/include/qemu/osdep.h >> @@ -25,6 +25,7 @@ >> #ifndef QEMU_OSDEP_H >> #define QEMU_OSDEP_H >> >> +#define _POSIX_C_SOURCE 200809L >> #include "config-host.h" >> #include "qemu/compiler.h" >> #include >> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h >> index 706d85a..74230e7 100644 >> --- a/include/sysemu/os-win32.h >> +++ b/include/sysemu/os-win32.h >> @@ -72,11 +72,17 @@ >> #define sigsetjmp(env, savemask) setjmp(env) >> #define siglongjmp(env, val) longjmp(env, val) >> >> +#ifdef gmtime_r >> /* Missing POSIX functions. Don't use MinGW-w64 macros. */ >> #undef gmtime_r >> +#define QEMU_NEED_GMTIME_R >> struct tm *gmtime_r(const time_t *timep, struct tm *result); >> +#endif > I don't think this is right. There are three possibilities > with mingw > > - No gmtime_r at all - need replacement > - gmtime_r defined as a macro - need replacement > - gmtime_r defined as a function - nothing needed > > With this change of yours, if gmtime_r is defined as a macro > QEMU will provide its own replacement. If gmtime_r is not > defined at all, then QEMU doesn't provide its replacement > which is wrong. I believe the change I previously proposed > works in all three cases > > https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01926.html indeed, this looks better to me. Den