From 63e1921d0be4956ab729735189ccf637773a7e27 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Mar 2013 15:08:17 +0000 Subject: [PATCH] Fix compilation with MinGW -std=c++11 option. With this option _strdup() is not available, so update the code defining wxCRT_StrdupA() to check for __WX_STRICT_ANSI_GCC__. Also try to simplify it a bit and make it more clear. Closes #15011. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/wxcrtbase.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index 406190292c..c126980533 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -164,14 +164,15 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrxfrmW wcsxfrm #endif /* __WXWINCE__ */ -/* Almost all compiler have strdup(), but VC++ for CE doesn't provide it. - Another special case is gcc in strict ANSI mode: normally it doesn't provide - strdup() but MinGW does provide it under MSVC-compatible name so test for it - before checking __WX_STRICT_ANSI_GCC__. */ -#if (defined(__VISUALC__) && __VISUALC__ >= 1400) || \ - defined(__MINGW32__) +/* Almost all compilers have strdup(), but VC++ and MinGW call it _strdup(). + And it's not available in MinGW strict ANSI mode nor under Windows CE. */ +#if (defined(__VISUALC__) && __VISUALC__ >= 1400) #define wxCRT_StrdupA _strdup -#elif !(defined(__WXWINCE__) || defined(__WX_STRICT_ANSI_GCC__)) +#elif defined(__MINGW32__) + #ifndef __WX_STRICT_ANSI_GCC__ + #define wxCRT_StrdupA _strdup + #endif +#elif !defined(__WXWINCE__) #define wxCRT_StrdupA strdup #endif -- 2.45.2