qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/8] qga: fixed warning in qemu-ga.exe for mingw


From: Olga Krishtal
Subject: Re: [Qemu-devel] [PATCH 1/8] qga: fixed warning in qemu-ga.exe for mingw >= 4.9.1
Date: Wed, 4 Feb 2015 17:25:34 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 04/02/15 00:29, Eric Blake wrote:
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?
/mingw/include/string.h:88:9: note: previous declaration of 'strtok_r' was here char *strtok_r(char * __restrict__ _Str, const char * __restrict__ _Delim, char ** __restrict__ __last);

/include/sysemu/os-win32.h:83:7: warning: redundant redeclaration of 'strtok_r' [-Wredundant-decls]
 char *strtok_r(char *str, const char *delim, char **saveptr);

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.

There is an idea to get rid of the strtok_r() because it is used only once, so we can replace it with other functions to get the same functionality.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]