Some more platform refactoring/cleanup, also add a note to readme
This commit is contained in:
parent
164cc75681
commit
973309cb22
@ -382,6 +382,8 @@ CPPTRACE_TRY {
|
||||
}
|
||||
```
|
||||
|
||||
This functionality is entirely opt-in, the macros are in `cpptrace/from_current.hpp`.
|
||||
|
||||
Any declarator `catch` accepts works with `CPPTRACE_CATCH`, including `...`.
|
||||
|
||||

|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include <system_error>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/microfmt.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
@ -40,9 +41,9 @@ namespace cpptrace {
|
||||
|
||||
unwind_interceptor::~unwind_interceptor() = default;
|
||||
|
||||
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
|
||||
#if IS_LIBSTDCXX
|
||||
constexpr size_t vtable_size = 11;
|
||||
#elif defined(_LIBCPP_VERSION)
|
||||
#elif IS_LIBCXX
|
||||
constexpr size_t vtable_size = 10;
|
||||
#else
|
||||
#warning "Cpptrace from_current: Unrecognized C++ standard library, from_current() won't be supported"
|
||||
|
||||
@ -3,17 +3,18 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
// libstdc++ and libc++
|
||||
#if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && (defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION))
|
||||
#include <cxxabi.h>
|
||||
#endif
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
// libstdc++ and libc++
|
||||
#if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && (IS_LIBSTDCXX || IS_LIBCXX)
|
||||
#include <cxxabi.h>
|
||||
#include "demangle/demangle.hpp"
|
||||
#endif
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
inline std::string exception_type_name() {
|
||||
#if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && (defined(__GLIBCXX__) || defined(__GLIBCPP__) || defined(_LIBCPP_VERSION))
|
||||
#if defined(CPPTRACE_HAS_CXX_EXCEPTION_TYPE) && (IS_LIBSTDCXX || IS_LIBCXX)
|
||||
const std::type_info* t = abi::__cxa_current_exception_type();
|
||||
return t ? detail::demangle(t->name()) : "<unknown>";
|
||||
#else
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define PATH_HPP
|
||||
|
||||
#include "utils/common.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#if IS_WINDOWS
|
||||
#include <windows.h>
|
||||
|
||||
@ -35,4 +35,14 @@
|
||||
#error "Unsupported compiler"
|
||||
#endif
|
||||
|
||||
#define IS_LIBSTDCXX 0
|
||||
#define IS_LIBCXX 0
|
||||
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
|
||||
#undef IS_LIBSTDCXX
|
||||
#define IS_LIBSTDCXX 1
|
||||
#elif defined(_LIBCPP_VERSION)
|
||||
#undef IS_LIBCXX
|
||||
#define IS_LIBCXX 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#if IS_WINDOWS
|
||||
#include <windows.h>
|
||||
|
||||
#define CPPTRACE_MAX_PATH MAX_PATH
|
||||
@ -31,7 +33,7 @@ namespace detail {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
#elif IS_APPLE
|
||||
|
||||
#include <cstdint>
|
||||
#include <mach-o/dyld.h>
|
||||
@ -61,7 +63,7 @@ namespace detail {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif IS_LINUX
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user