From 9f9da9dc9b49624ec6cd9237ec79aca604983c4a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 7 Jan 2019 13:34:52 +0300 Subject: [PATCH] Limit __cxa_uncaught_exceptions to only since libc++abi 1002 and later. --- include/boost/core/uncaught_exceptions.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/core/uncaught_exceptions.hpp b/include/boost/core/uncaught_exceptions.hpp index fa9d25e..c48aca2 100644 --- a/include/boost/core/uncaught_exceptions.hpp +++ b/include/boost/core/uncaught_exceptions.hpp @@ -50,13 +50,14 @@ #include // On Linux with clang and libc++, there is a version of cxxabi.h from libc++-abi that doesn't declare __cxa_get_globals, but provides __cxa_uncaught_exceptions. -#if defined(_LIBCPPABI_VERSION) +// The function only appeared in version 1002. +#if defined(_LIBCPPABI_VERSION) && _LIBCPPABI_VERSION >= 1002 #define BOOST_CORE_HAS_CXA_UNCAUGHT_EXCEPTIONS #else #define BOOST_CORE_HAS_CXA_GET_GLOBALS // On MinGW only GCC 4.7 declares __cxa_get_globals() in cxxabi.h, older compilers do not expose this function but it's there. // Note that at least on FreeBSD 11, cxxabi.h declares __cxa_get_globals with a different exception specification, so we can't declare the function unconditionally. -#if (defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) +#if (defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) || defined(_LIBCPPABI_VERSION) namespace __cxxabiv1 { struct __cxa_eh_globals; extern "C" __cxa_eh_globals* __cxa_get_globals() BOOST_NOEXCEPT_OR_NOTHROW __attribute__((__const__));