From 420dff80b5f67287dda43de6b2291bf6cde067e7 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jun 2019 15:28:12 +0300 Subject: [PATCH] Added a workaround for QNX in uncaught_exceptions.hpp. QNX provides cxxabi.h from LLVM libc++abi, which does not declare __cxa_get_globals but provides its implementation in the library. To make things more fun, QNX developers commented _LIBCPPABI_VERSION definition, which breaks detection of libc++abi in uncaught_exceptions.hpp. There is also cxxabi.h from glibcxx that does provide __cxa_get_globals declaration. We want to use that declaration, if possible, to avoid possible mismatch in attributes. This commit adds non-glibcxx cxxabi.h on QNX to the list of platforms that need our declaration of __cxa_get_globals. Fixes https://github.com/boostorg/core/issues/59. --- include/boost/core/uncaught_exceptions.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/core/uncaught_exceptions.hpp b/include/boost/core/uncaught_exceptions.hpp index c39120b..db7a7a1 100644 --- a/include/boost/core/uncaught_exceptions.hpp +++ b/include/boost/core/uncaught_exceptions.hpp @@ -56,10 +56,13 @@ // On Linux with clang and libc++ and on OS X, there is a version of cxxabi.h from libc++abi that doesn't declare __cxa_get_globals, but provides __cxa_uncaught_exceptions. // The function only appeared in version _LIBCPPABI_VERSION >= 1002 of the library. Unfortunately, there are linking errors about undefined reference to __cxa_uncaught_exceptions // on Ubuntu Trusty and OS X, so we avoid using it and forward-declare __cxa_get_globals instead. +// On QNX SDP 7.0 (QCC 5.4.0), there are multiple cxxabi.h, one from glibcxx from gcc and another from libc++abi from LLVM. The latter is included first by qcc. It is missing +// the declaration of __cxa_get_globals but it is also patched by QNX developers to not define _LIBCPPABI_VERSION. https://github.com/boostorg/core/issues/59 #if !defined(__FreeBSD__) && \ ( \ (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) || \ defined(__OpenBSD__) || \ + (defined(__QNXNTO__) && !defined(__GLIBCXX__) && !defined(__GLIBCPP__)) || \ defined(_LIBCPPABI_VERSION) \ ) namespace __cxxabiv1 {