Fix build with MinGW 5.3 in debug mode
Due to a bug in MinGW (see https://sourceforge.net/p/mingw/bugs/2322/), _stricmp() and _strnicmp() declarations are not visible when compiling without optimizations. Work around this by declaring them ourselves. See #17762.
This commit is contained in:
@@ -149,26 +149,34 @@
|
|||||||
the new C++11 features and not disable the use of POSIX functions, we just
|
the new C++11 features and not disable the use of POSIX functions, we just
|
||||||
manually declare the functions we need in this case if necessary.
|
manually declare the functions we need in this case if necessary.
|
||||||
*/
|
*/
|
||||||
#if defined(__MINGW32_TOOLCHAIN__) && defined(__STRICT_ANSI__)
|
#ifdef __MINGW32_TOOLCHAIN__
|
||||||
#define wxNEEDS_STRICT_ANSI_WORKAROUNDS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This macro is somewhat unusual as it takes the list of parameters
|
This macro is somewhat unusual as it takes the list of parameters
|
||||||
inside parentheses and includes semicolon inside it as putting the
|
inside parentheses and includes semicolon inside it as putting the
|
||||||
semicolon outside wouldn't do the right thing when this macro is empty.
|
semicolon outside wouldn't do the right thing when this macro is empty.
|
||||||
*/
|
*/
|
||||||
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \
|
#define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) \
|
||||||
extern "C" _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ;
|
extern "C" _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ;
|
||||||
|
|
||||||
/*
|
#ifdef __STRICT_ANSI__
|
||||||
There is a bug resulting in a compilation error in MinGW standard
|
#define wxNEEDS_STRICT_ANSI_WORKAROUNDS
|
||||||
math.h header, see https://sourceforge.net/p/mingw/bugs/2250/, work
|
|
||||||
around it here because math.h is also included from several other
|
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \
|
||||||
standard headers (e.g. <algorithm>) and we don't want to duplicate this
|
wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
|
||||||
hack everywhere this happens.
|
|
||||||
*/
|
/*
|
||||||
wxDECL_FOR_STRICT_MINGW32(double, _hypot, (double, double))
|
There is a bug resulting in a compilation error in MinGW standard
|
||||||
|
math.h header, see https://sourceforge.net/p/mingw/bugs/2250/, work
|
||||||
|
around it here because math.h is also included from several other
|
||||||
|
standard headers (e.g. <algorithm>) and we don't want to duplicate this
|
||||||
|
hack everywhere this happens.
|
||||||
|
*/
|
||||||
|
wxDECL_FOR_STRICT_MINGW32(double, _hypot, (double, double))
|
||||||
|
#else
|
||||||
|
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
|
||||||
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
|
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -358,6 +358,7 @@
|
|||||||
# define wxCHECK_W32API_VERSION(maj, min) (0)
|
# define wxCHECK_W32API_VERSION(maj, min) (0)
|
||||||
# undef wxCHECK_MINGW32_VERSION
|
# undef wxCHECK_MINGW32_VERSION
|
||||||
# define wxCHECK_MINGW32_VERSION( major, minor ) (0)
|
# define wxCHECK_MINGW32_VERSION( major, minor ) (0)
|
||||||
|
# define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
|
||||||
# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
|
# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -230,8 +230,15 @@ extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int
|
|||||||
#define wxCRT_StricmpA stricmp
|
#define wxCRT_StricmpA stricmp
|
||||||
#define wxCRT_StrnicmpA strnicmp
|
#define wxCRT_StrnicmpA strnicmp
|
||||||
#elif defined(__VISUALC__) || defined(__MINGW32__)
|
#elif defined(__VISUALC__) || defined(__MINGW32__)
|
||||||
wxDECL_FOR_STRICT_MINGW32(int, _stricmp, (const char*, const char*))
|
/*
|
||||||
wxDECL_FOR_STRICT_MINGW32(int, _strnicmp, (const char*, const char*, size_t))
|
Due to MinGW 5.3 bug (https://sourceforge.net/p/mingw/bugs/2322/),
|
||||||
|
_stricmp() and _strnicmp() are not declared in its standard headers
|
||||||
|
when compiling without optimizations. Work around this by always
|
||||||
|
declaring them ourselves (notice that if/when this bug were fixed, we'd
|
||||||
|
still need to use wxDECL_FOR_STRICT_MINGW32() for them here.
|
||||||
|
*/
|
||||||
|
wxDECL_FOR_MINGW32_ALWAYS(int, _stricmp, (const char*, const char*))
|
||||||
|
wxDECL_FOR_MINGW32_ALWAYS(int, _strnicmp, (const char*, const char*, size_t))
|
||||||
|
|
||||||
#define wxCRT_StricmpA _stricmp
|
#define wxCRT_StricmpA _stricmp
|
||||||
#define wxCRT_StrnicmpA _strnicmp
|
#define wxCRT_StrnicmpA _strnicmp
|
||||||
|
Reference in New Issue
Block a user