On 12/31/2014 06:06 AM, Denis V. Lunev wrote:
From: Olga Krishtal <address@hidden>
strtok_r was redefined before the patch
Signed-off-by: Olga Krishtal <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Michael Roth <address@hidden>
---
include/sysemu/os-win32.h | 2 ++
1 file changed, 2 insertions(+)
What's the actual compiler error you get without this patch?
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index af3fbc4..84e229b 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -81,7 +81,9 @@ 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);
+#if defined __MINGW32__ && !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 9)
char *strtok_r(char *str, const char *delim, char **saveptr);
It feels weird to key off of the gcc version. Whether strtok_r is
defined is a property of the system headers, not the compiler. For
example, I'm aware a but where older mingw <pthreads.h> would pollute
the namespace with a broken #define of strtok_r; but that has been fixed
in newer mingw headers (on Fedora, I know that F20 mingw has the bug,
F21 does not). But that is the version of mingw, not the version of
gcc, that determined that problem. Therefore, I'm not sure this is the
right patch, but without knowing the symptoms it fixes, I don't know if
anything is better.