The cxxabi.h header is not used on Windows when using the Microsoft C++ runtime. Most people build with the Microsoft STL when building on Windows, but I am using libc++, and I have found that the protection against including cxxabi.h doesn't work in this case:
My guess is that they are meant to be evaluated as: defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION
but the preprocessor operator precedence makes it evaluated as: defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION)
Since I am using libc++, _LIBCPP_VERSION is defined, which means I get a compile error because it can't find cxxabi.h, even though CPPTRACE_HAS_CXX_EXCEPTION_TYPE is not defined.
Is this the correct interpretation of what the #if is meant to check, and if so, would making the precedence of operations explicit in these expressions be the best way to solve the issue?
The
cxxabi.h
header is not used on Windows when using the Microsoft C++ runtime. Most people build with the Microsoft STL when building on Windows, but I am using libc++, and I have found that the protection against includingcxxabi.h
doesn't work in this case:https://github.com/jeremy-rifkin/cpptrace/blob/d2b940ab07521df8baeff0fbf7aea68d94dffc65/src/utils/exception_type.hpp#L7 and https://github.com/jeremy-rifkin/cpptrace/blob/d2b940ab07521df8baeff0fbf7aea68d94dffc65/src/utils/exception_type.hpp#L16
My guess is that they are meant to be evaluated as:
defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE)
&&defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION
but the preprocessor operator precedence makes it evaluated as:defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && defined(__GLIBCXX__)
||defined(__GLIBCPP__)
||defined(_LIBCPP_VERSION)
Since I am using libc++,
_LIBCPP_VERSION
is defined, which means I get a compile error because it can't findcxxabi.h
, even thoughCPPTRACE_HAS_CXX_EXCEPTION_TYPE
is not defined.Is this the correct interpretation of what the
#if
is meant to check, and if so, would making the precedence of operations explicit in these expressions be the best way to solve the issue?