From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ0to-0001we-Hg for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:25:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ0tj-0000RO-F0 for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:25:48 -0500 Received: from mx2.parallels.com ([199.115.105.18]:35096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ0ti-0000RH-TA for qemu-devel@nongnu.org; Wed, 04 Feb 2015 09:25:43 -0500 Message-ID: <54D22BDE.8060508@parallels.com> Date: Wed, 4 Feb 2015 17:25:34 +0300 From: Olga Krishtal MIME-Version: 1.0 References: <1420031214-6053-1-git-send-email-den@openvz.org> <1420031214-6053-2-git-send-email-den@openvz.org> <54D13DB0.2080302@redhat.com> In-Reply-To: <54D13DB0.2080302@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/8] qga: fixed warning in qemu-ga.exe for mingw >= 4.9.1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , "Denis V. Lunev" Cc: Michael Roth , qemu-devel@nongnu.org On 04/02/15 00:29, Eric Blake wrote: > On 12/31/2014 06:06 AM, Denis V. Lunev wrote: >> From: Olga Krishtal >> >> strtok_r was redefined before the patch >> >> Signed-off-by: Olga Krishtal >> Signed-off-by: Denis V. Lunev >> CC: Michael Roth >> --- >> 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 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.