From 6f3e6254e7f4980673ec0e2d3accb3252b629c0a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 6 Jan 2019 21:29:15 +0300 Subject: [PATCH] Only declare __cxa_get_globals on MinGW gcc < 4.7, where it's needed. This should work around differences between the function signatures on other platforms, like FreeBSD, for example. --- include/boost/core/uncaught_exceptions.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/core/uncaught_exceptions.hpp b/include/boost/core/uncaught_exceptions.hpp index 6dbdce1..686487c 100644 --- a/include/boost/core/uncaught_exceptions.hpp +++ b/include/boost/core/uncaught_exceptions.hpp @@ -47,15 +47,15 @@ // MinGW GCC 4.4 seem to not work the same way the newer GCC versions do. As a result, __cxa_get_globals based implementation will always return 0. // Just disable it for now and fall back to std::uncaught_exception(). #if !defined(__MINGW32__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) -#define BOOST_CORE_HAS_CXA_GET_GLOBALS #include -// Only GCC 4.7 declares __cxa_get_globals() in cxxabi.h, older compilers do not expose this function but it's there -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407 +#define BOOST_CORE_HAS_CXA_GET_GLOBALS +// Only MinGW GCC 4.7 declares __cxa_get_globals() in cxxabi.h, older compilers do not expose this function but it's there +#if defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407 namespace __cxxabiv1 { struct __cxa_eh_globals; extern "C" __cxa_eh_globals* __cxa_get_globals() BOOST_NOEXCEPT_OR_NOTHROW __attribute__((__const__)); } // namespace __cxxabiv1 -#endif // defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407 +#endif // defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407 #endif #endif // defined(BOOST_CORE_HAS_CXXABI_H)