oslib-win32: use localtime_r/gmtime_r that is provided by MinGW
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 16 Nov 2015 05:40:42 +0000 (14:40 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 16 Nov 2015 06:47:43 +0000 (15:47 +0900)
Recent MinGW-w64 contains their own localtime_r() and gmtime_r(). But
it is only enabled under specific including order.
This issue is resolved by 4d9310f427b477a126f6f2006c3a73b9764948b6 in
upstream. But it is dependent on other commits that contain complex
modifications.
So now, we choose simple solution for it - just re-arrange header
including order.

Change-Id: Ie1a8d46baa9a5e8f1140362faa81567b1ba257a5
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
include/qemu-common.h
include/sysemu/os-win32.h
util/oslib-win32.c

index fb3da6c..e4345f9 100644 (file)
 #include <strings.h>
 #include <inttypes.h>
 #include <limits.h>
+// CONFIG_MARU MODIFICATION
+// recent MinGW-w64 provides gmtime_r(), localtime_r(). we use them.
+// for that, unistd.h should be included before time.h
+#include <unistd.h>
 #include <time.h>
 #include <ctype.h>
 #include <errno.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/time.h>
index de356e3..795da47 100644 (file)
 #define sigsetjmp(env, savemask) setjmp(env)
 #define siglongjmp(env, val) longjmp(env, val)
 
-/* Missing POSIX functions. Don't use MinGW-w64 macros. */
 // CONFIG_MARU MODIFICATION
-#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
+// recent MinGW-w64 provides gmtime_r(), localtime_r(). we use them.
+#if 0
+/* 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);
-#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
-#pragma GCC diagnostic pop
 #endif
 
 
index 23d934a..217f28a 100644 (file)
@@ -110,6 +110,9 @@ void qemu_anon_ram_free(void *ptr, size_t size)
     }
 }
 
+// CONFIG_MARU MODIFICATION
+// recent MinGW-w64 provides gmtime_r(), localtime_r(). we use them.
+#if 0
 /* FIXME: add proper locking */
 struct tm *gmtime_r(const time_t *timep, struct tm *result)
 {
@@ -133,6 +136,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
     }
     return p;
 }
+#endif
 
 void qemu_set_block(int fd)
 {