From 6787d2268ae158e409a11ae88c099e3b8bc840c7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Jun 2015 02:21:58 +0200 Subject: [PATCH] Improve workaround for MinGW math.h bug in strict ANSI mode. Declare _hypot() function globally, predefining __NO_INLINE__ in wx/math.h is not enough as is also included from some other standard headers, e.g. , and including them results in the same bug as in wx/math.h (i.e. https://sourceforge.net/p/mingw/bugs/2250/). --- include/wx/math.h | 11 ----------- include/wx/msw/gccpriv.h | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/wx/math.h b/include/wx/math.h index c6aec42c4e..ba298f17b0 100644 --- a/include/wx/math.h +++ b/include/wx/math.h @@ -15,17 +15,6 @@ #include "wx/defs.h" -#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS - /* - In addition to declaring _finite() ourselves below, we also must work - around a compilation error in MinGW standard header itself, see - https://sourceforge.net/p/mingw/bugs/2250/ - */ - #ifndef __NO_INLINE__ - #define __NO_INLINE__ - #endif -#endif - #include #ifndef M_PI diff --git a/include/wx/msw/gccpriv.h b/include/wx/msw/gccpriv.h index acebc1f1e8..cabda414e2 100644 --- a/include/wx/msw/gccpriv.h +++ b/include/wx/msw/gccpriv.h @@ -151,6 +151,15 @@ */ #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \ extern "C" _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ; + + /* + 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. ) 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