From 1488460172fe78d8c803b6706a9969ad8674ef79 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 19 Feb 2024 00:16:04 +0700 Subject: [PATCH] Use `defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE)`. (#94) This is set by the build system when it is available and not set when not available (and not set to 1/0 respectively). The current code can generate a warning when this preprocessor definition is not defined. --- src/utils/exception_type.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/exception_type.hpp b/src/utils/exception_type.hpp index 25d44b6..0d9047e 100644 --- a/src/utils/exception_type.hpp +++ b/src/utils/exception_type.hpp @@ -4,7 +4,7 @@ #include // libstdc++ and libc++ -#if CPPTRACE_HAS_CXX_EXCEPTION_TYPE && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION) +#if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION) #include #endif @@ -13,7 +13,7 @@ namespace cpptrace { namespace detail { inline std::string exception_type_name() { - #if CPPTRACE_HAS_CXX_EXCEPTION_TYPE && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION) + #if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION) const std::type_info* t = abi::__cxa_current_exception_type(); return t ? detail::demangle(t->name()) : ""; #else