diff --git a/include/exception b/include/exception index f43c84c..4266fa2 100644 --- a/include/exception +++ b/include/exception @@ -105,7 +105,7 @@ class _LIBCPP_EXCEPTION_ABI exception public: _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT { -#ifdef STD_EXCEPTION_HAS_STACK_TRACE +#if defined(STD_EXCEPTION_HAS_STACK_TRACE) capture(); #endif } @@ -113,21 +113,15 @@ public: virtual ~exception() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; -#ifdef STD_EXCEPTION_HAS_STACK_TRACE +#if defined(STD_EXCEPTION_HAS_STACK_TRACE) /// This is ClickHouse patch to libc++. It breaks ABI, so you cannot link your code with any C++ library /// that has any std::exception-related symbols exported and was built without this patch. - void ** const get_stack_trace_frames() const _NOEXCEPT { return const_cast(frames); } - int get_stack_trace_size() const _NOEXCEPT { return size; } - void set_stack_trace(void ** frames_, int size_) _NOEXCEPT - { - size = size_; - for (int i = 0; i < size; ++i) - frames[i] = frames_[i]; - } + void * const * get_stack_trace_frames() const _NOEXCEPT { return frames; } + size_t get_stack_trace_size() const _NOEXCEPT { return size; } private: - static constexpr int capacity = 32; + static constexpr size_t capacity = 32; void * frames[capacity]; - int size = 0; + size_t size = 0; void capture() _NOEXCEPT { size = unw_backtrace(frames, capacity);