Fix building and using the library with MinGW -std=c++{98,11} options.

These options enable "strict ANSI" mode in MinGW which omits declarations of
POSIX functions from the standard headers. To allow the library and, possibly
even more importantly, the user code including our headers, to compile with
these options, declare the functions that we need ourselves.

This might appear to go against the spirit of "strict ANSI" mode, but the only
alternative would be to not use such functions at all and silently cripple the
library when -std=c++NN is used, compared to -std=g++NN case, and this doesn't
seem appealing neither.

Closes #16984.
This commit is contained in:
Vadim Zeitlin
2015-06-12 17:43:33 +02:00
parent 15d9067006
commit cc774bb301
11 changed files with 98 additions and 1 deletions

View File

@@ -73,6 +73,9 @@
#ifdef wxNEED_ISASCII
inline int isascii(int c) { return (unsigned)c < 0x80; }
// Avoid further (re)definitions of it.
#define isascii isascii
#endif
#ifdef _WIN32_WCE
@@ -451,6 +454,11 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha
#define wxCRT_Rename rename
#else /* Unicode filenames */
wxDECL_FOR_STRICT_MINGW32(FILE*, _wfopen, (const wchar_t*, const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(FILE*, _wfreopen, (const wchar_t*, const wchar_t*, FILE*))
wxDECL_FOR_STRICT_MINGW32(int, _wrename, (const wchar_t*, const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(int, _wremove, (const wchar_t*))
/* WinCE CRT doesn't provide these functions so use our own */
#ifdef __WXWINCE__
WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src,