diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/cxxsupp/libcxxrt | |
parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
download | ydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxrt')
-rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/cxxabi.h | 8 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/exception.cc | 140 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/memory.cc | 4 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/stdexcept.cc | 48 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/stdexcept.h | 48 |
5 files changed, 124 insertions, 124 deletions
diff --git a/contrib/libs/cxxsupp/libcxxrt/cxxabi.h b/contrib/libs/cxxsupp/libcxxrt/cxxabi.h index 23c8b49162..7a8cb6745f 100644 --- a/contrib/libs/cxxsupp/libcxxrt/cxxabi.h +++ b/contrib/libs/cxxsupp/libcxxrt/cxxabi.h @@ -236,10 +236,10 @@ char* __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status); - -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE -size_t __cxa_collect_current_exception_backtrace(void** dest, size_t size); -#endif + +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE +size_t __cxa_collect_current_exception_backtrace(void** dest, size_t size); +#endif #ifdef __cplusplus } // extern "C" } // namespace diff --git a/contrib/libs/cxxsupp/libcxxrt/exception.cc b/contrib/libs/cxxsupp/libcxxrt/exception.cc index 4bf2811551..6baf428ead 100644 --- a/contrib/libs/cxxsupp/libcxxrt/exception.cc +++ b/contrib/libs/cxxsupp/libcxxrt/exception.cc @@ -197,7 +197,7 @@ struct __cxa_dependent_exception _Unwind_Exception unwindHeader; }; -static_assert(sizeof(__cxa_dependent_exception) == sizeof(__cxa_exception)); +static_assert(sizeof(__cxa_dependent_exception) == sizeof(__cxa_exception)); namespace std { @@ -205,8 +205,8 @@ namespace std class exception { public: - virtual ~exception(); - virtual const char* what() const noexcept; + virtual ~exception(); + virtual const char* what() const noexcept; }; } @@ -219,20 +219,20 @@ namespace std * various checks may test for equality of the class, which is incorrect. */ static const uint64_t exception_class = -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE - _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_PRIMARY_CLASS; -#else +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE + _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_PRIMARY_CLASS; +#else EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\0'); -#endif +#endif /** * Class used for dependent exceptions. */ static const uint64_t dependent_exception_class = -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE - _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_DEPENDENT_CLASS; -#else +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE + _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_DEPENDENT_CLASS; +#else EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\x01'); -#endif +#endif /** * The low four bytes of the exception class, indicating that we conform to the * Itanium C++ ABI. This is currently unused, but should be used in the future @@ -660,18 +660,18 @@ static_assert(align_to(15, 16) == 16); static_assert(align_to(16, 16) == 16); static_assert(align_to(17, 16) == 32); -static constexpr size_t exception_size = align_to(sizeof(__cxa_exception), 16); -static constexpr size_t dependent_exception_size = align_to(sizeof(__cxa_dependent_exception), 16); -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE -static constexpr size_t backtrace_buffer_size = align_to(sizeof(_Unwind_Backtrace_Buffer), 16); - -static_assert( - _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_MAGIC_OFFSET == - offsetof(__cxa_exception, unwindHeader) + backtrace_buffer_size - sizeof(_Unwind_Backtrace_Buffer)); -#else -static constexpr size_t backtrace_buffer_size = 0; -#endif - +static constexpr size_t exception_size = align_to(sizeof(__cxa_exception), 16); +static constexpr size_t dependent_exception_size = align_to(sizeof(__cxa_dependent_exception), 16); +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE +static constexpr size_t backtrace_buffer_size = align_to(sizeof(_Unwind_Backtrace_Buffer), 16); + +static_assert( + _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_MAGIC_OFFSET == + offsetof(__cxa_exception, unwindHeader) + backtrace_buffer_size - sizeof(_Unwind_Backtrace_Buffer)); +#else +static constexpr size_t backtrace_buffer_size = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -680,19 +680,19 @@ static constexpr size_t backtrace_buffer_size = 0; */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + exception_size + backtrace_buffer_size; + size_t size = thrown_size + exception_size + backtrace_buffer_size; char *buffer = alloc_or_die(size); -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE - ((_Unwind_Backtrace_Buffer *)buffer)->size = 0; -#endif - return buffer + exception_size + backtrace_buffer_size; +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE + ((_Unwind_Backtrace_Buffer *)buffer)->size = 0; +#endif + return buffer + exception_size + backtrace_buffer_size; } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = dependent_exception_size + backtrace_buffer_size; + size_t size = dependent_exception_size + backtrace_buffer_size; char *buffer = alloc_or_die(size); - return buffer + dependent_exception_size + backtrace_buffer_size; + return buffer + dependent_exception_size + backtrace_buffer_size; } /** @@ -720,8 +720,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception( - reinterpret_cast<char*>(thrown_exception) - exception_size - backtrace_buffer_size); + free_exception( + reinterpret_cast<char*>(thrown_exception) - exception_size - backtrace_buffer_size); } static void releaseException(__cxa_exception *exception) @@ -748,7 +748,7 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast<char*>(thrown_exception) - dependent_exception_size - backtrace_buffer_size); + free_exception(reinterpret_cast<char*>(thrown_exception) - dependent_exception_size - backtrace_buffer_size); } /** @@ -758,7 +758,7 @@ void __cxa_free_dependent_exception(void *thrown_exception) * a handler, prints a back trace before aborting. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -extern "C" void *__cxa_begin_catch(void *e) noexcept; +extern "C" void *__cxa_begin_catch(void *e) noexcept; #else extern "C" void *__cxa_begin_catch(void *e); #endif @@ -910,32 +910,32 @@ extern "C" void __cxa_decrement_exception_refcount(void* thrown_exception) releaseException(ex); } -#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE -static size_t __cxa_collect_backtrace(__cxa_exception* ex, void** dest, size_t size) { - if (!ex) { - return 0; - } - if (!isCXXException(ex->unwindHeader.exception_class)) { - return 0; - } - size_t i = 0; - if (isDependentException(ex->unwindHeader.exception_class)) { - i = __cxa_collect_backtrace( - (__cxa_exception *)((__cxa_dependent_exception *)ex)->primaryException - 1, dest, size); - } - _Unwind_Backtrace_Buffer* backtraceBuffer = (_Unwind_Backtrace_Buffer*)( - (char *)(ex + 1) - exception_size - backtrace_buffer_size); - for (size_t j = 0; i != size && j != backtraceBuffer->size; ++i, ++j) { - dest[i] = backtraceBuffer->backtrace[j]; - } - return i; -} - -extern "C" size_t __cxa_collect_current_exception_backtrace(void** dest, size_t size) { - return __cxa_collect_backtrace(__cxa_get_globals()->caughtExceptions, dest, size); -} -#endif - +#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE +static size_t __cxa_collect_backtrace(__cxa_exception* ex, void** dest, size_t size) { + if (!ex) { + return 0; + } + if (!isCXXException(ex->unwindHeader.exception_class)) { + return 0; + } + size_t i = 0; + if (isDependentException(ex->unwindHeader.exception_class)) { + i = __cxa_collect_backtrace( + (__cxa_exception *)((__cxa_dependent_exception *)ex)->primaryException - 1, dest, size); + } + _Unwind_Backtrace_Buffer* backtraceBuffer = (_Unwind_Backtrace_Buffer*)( + (char *)(ex + 1) - exception_size - backtrace_buffer_size); + for (size_t j = 0; i != size && j != backtraceBuffer->size; ++i, ++j) { + dest[i] = backtraceBuffer->backtrace[j]; + } + return i; +} + +extern "C" size_t __cxa_collect_current_exception_backtrace(void** dest, size_t size) { + return __cxa_collect_backtrace(__cxa_get_globals()->caughtExceptions, dest, size); +} +#endif + /** * ABI function. Rethrows the current exception. Does not remove the * exception from the stack or decrement its handler count - the compiler is @@ -1322,7 +1322,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_personality_v0) * C++ exceptions) of the unadjusted pointer (for foreign exceptions). */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -extern "C" void *__cxa_begin_catch(void *e) noexcept +extern "C" void *__cxa_begin_catch(void *e) noexcept #else extern "C" void *__cxa_begin_catch(void *e) #endif @@ -1531,14 +1531,14 @@ namespace pathscale /** * Sets whether unexpected and terminate handlers should be thread-local. */ - void set_use_thread_local_handlers(bool flag) noexcept + void set_use_thread_local_handlers(bool flag) noexcept { thread_local_handlers = flag; } /** * Sets a thread-local unexpected handler. */ - unexpected_handler set_unexpected(unexpected_handler f) noexcept + unexpected_handler set_unexpected(unexpected_handler f) noexcept { static __cxa_thread_info *info = thread_info(); unexpected_handler old = info->unexpectedHandler; @@ -1548,7 +1548,7 @@ namespace pathscale /** * Sets a thread-local terminate handler. */ - terminate_handler set_terminate(terminate_handler f) noexcept + terminate_handler set_terminate(terminate_handler f) noexcept { static __cxa_thread_info *info = thread_info(); terminate_handler old = info->terminateHandler; @@ -1563,7 +1563,7 @@ namespace std * Sets the function that will be called when an exception specification is * violated. */ - unexpected_handler set_unexpected(unexpected_handler f) noexcept + unexpected_handler set_unexpected(unexpected_handler f) noexcept { if (thread_local_handlers) { return pathscale::set_unexpected(f); } @@ -1572,7 +1572,7 @@ namespace std /** * Sets the function that is called to terminate the program. */ - terminate_handler set_terminate(terminate_handler f) noexcept + terminate_handler set_terminate(terminate_handler f) noexcept { if (thread_local_handlers) { return pathscale::set_terminate(f); } @@ -1615,7 +1615,7 @@ namespace std * Returns whether there are any exceptions currently being thrown that * have not been caught. This can occur inside a nested catch statement. */ - bool uncaught_exception() noexcept + bool uncaught_exception() noexcept { __cxa_thread_info *info = thread_info(); return info->globals.uncaughtExceptions != 0; @@ -1624,7 +1624,7 @@ namespace std * Returns the number of exceptions currently being thrown that have not * been caught. This can occur inside a nested catch statement. */ - int uncaught_exceptions() noexcept + int uncaught_exceptions() noexcept { __cxa_thread_info *info = thread_info(); return info->globals.uncaughtExceptions; @@ -1632,7 +1632,7 @@ namespace std /** * Returns the current unexpected handler. */ - unexpected_handler get_unexpected() noexcept + unexpected_handler get_unexpected() noexcept { __cxa_thread_info *info = thread_info(); if (info->unexpectedHandler) @@ -1644,7 +1644,7 @@ namespace std /** * Returns the current terminate handler. */ - terminate_handler get_terminate() noexcept + terminate_handler get_terminate() noexcept { __cxa_thread_info *info = thread_info(); if (info->terminateHandler) diff --git a/contrib/libs/cxxsupp/libcxxrt/memory.cc b/contrib/libs/cxxsupp/libcxxrt/memory.cc index 9daa043ff2..694c5d5037 100644 --- a/contrib/libs/cxxsupp/libcxxrt/memory.cc +++ b/contrib/libs/cxxsupp/libcxxrt/memory.cc @@ -59,12 +59,12 @@ namespace std * Sets a function to be called when there is a failure in new. */ __attribute__((weak)) - new_handler set_new_handler(new_handler handler) noexcept + new_handler set_new_handler(new_handler handler) noexcept { return ATOMIC_SWAP(&new_handl, handler); } __attribute__((weak)) - new_handler get_new_handler(void) noexcept + new_handler get_new_handler(void) noexcept { return ATOMIC_LOAD(&new_handl); } diff --git a/contrib/libs/cxxsupp/libcxxrt/stdexcept.cc b/contrib/libs/cxxsupp/libcxxrt/stdexcept.cc index 964c4adb44..07c62a731b 100644 --- a/contrib/libs/cxxsupp/libcxxrt/stdexcept.cc +++ b/contrib/libs/cxxsupp/libcxxrt/stdexcept.cc @@ -31,66 +31,66 @@ namespace std { -exception::exception() noexcept {} -exception::~exception() {} -exception::exception(const exception&) noexcept {} -exception& exception::operator=(const exception&) noexcept +exception::exception() noexcept {} +exception::~exception() {} +exception::exception(const exception&) noexcept {} +exception& exception::operator=(const exception&) noexcept { return *this; } -const char* exception::what() const noexcept +const char* exception::what() const noexcept { return "std::exception"; } -bad_alloc::bad_alloc() noexcept {} -bad_alloc::~bad_alloc() {} -bad_alloc::bad_alloc(const bad_alloc&) noexcept {} -bad_alloc& bad_alloc::operator=(const bad_alloc&) noexcept +bad_alloc::bad_alloc() noexcept {} +bad_alloc::~bad_alloc() {} +bad_alloc::bad_alloc(const bad_alloc&) noexcept {} +bad_alloc& bad_alloc::operator=(const bad_alloc&) noexcept { return *this; } -const char* bad_alloc::what() const noexcept +const char* bad_alloc::what() const noexcept { return "cxxrt::bad_alloc"; } -bad_cast::bad_cast() noexcept {} -bad_cast::~bad_cast() {} -bad_cast::bad_cast(const bad_cast&) noexcept {} -bad_cast& bad_cast::operator=(const bad_cast&) noexcept +bad_cast::bad_cast() noexcept {} +bad_cast::~bad_cast() {} +bad_cast::bad_cast(const bad_cast&) noexcept {} +bad_cast& bad_cast::operator=(const bad_cast&) noexcept { return *this; } -const char* bad_cast::what() const noexcept +const char* bad_cast::what() const noexcept { return "std::bad_cast"; } -bad_typeid::bad_typeid() noexcept {} -bad_typeid::~bad_typeid() {} -bad_typeid::bad_typeid(const bad_typeid &__rhs) noexcept {} -bad_typeid& bad_typeid::operator=(const bad_typeid &__rhs) noexcept +bad_typeid::bad_typeid() noexcept {} +bad_typeid::~bad_typeid() {} +bad_typeid::bad_typeid(const bad_typeid &__rhs) noexcept {} +bad_typeid& bad_typeid::operator=(const bad_typeid &__rhs) noexcept { return *this; } -const char* bad_typeid::what() const noexcept +const char* bad_typeid::what() const noexcept { return "std::bad_typeid"; } -bad_array_new_length::bad_array_new_length() noexcept {} +bad_array_new_length::bad_array_new_length() noexcept {} bad_array_new_length::~bad_array_new_length() {} -bad_array_new_length::bad_array_new_length(const bad_array_new_length&) noexcept {} -bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) noexcept +bad_array_new_length::bad_array_new_length(const bad_array_new_length&) noexcept {} +bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) noexcept { return *this; } -const char* bad_array_new_length::what() const noexcept +const char* bad_array_new_length::what() const noexcept { return "std::bad_array_new_length"; } diff --git a/contrib/libs/cxxsupp/libcxxrt/stdexcept.h b/contrib/libs/cxxsupp/libcxxrt/stdexcept.h index a442a9f3ee..13763f4824 100644 --- a/contrib/libs/cxxsupp/libcxxrt/stdexcept.h +++ b/contrib/libs/cxxsupp/libcxxrt/stdexcept.h @@ -35,11 +35,11 @@ namespace std class exception { public: - exception() noexcept; - exception(const exception&) noexcept; - exception& operator=(const exception&) noexcept; - virtual ~exception(); - virtual const char* what() const noexcept; + exception() noexcept; + exception(const exception&) noexcept; + exception& operator=(const exception&) noexcept; + virtual ~exception(); + virtual const char* what() const noexcept; }; @@ -49,11 +49,11 @@ namespace std class bad_alloc: public exception { public: - bad_alloc() noexcept; - bad_alloc(const bad_alloc&) noexcept; - bad_alloc& operator=(const bad_alloc&) noexcept; - ~bad_alloc(); - virtual const char* what() const noexcept; + bad_alloc() noexcept; + bad_alloc(const bad_alloc&) noexcept; + bad_alloc& operator=(const bad_alloc&) noexcept; + ~bad_alloc(); + virtual const char* what() const noexcept; }; /** @@ -61,11 +61,11 @@ namespace std */ class bad_cast: public exception { public: - bad_cast() noexcept; - bad_cast(const bad_cast&) noexcept; - bad_cast& operator=(const bad_cast&) noexcept; - virtual ~bad_cast(); - virtual const char* what() const noexcept; + bad_cast() noexcept; + bad_cast(const bad_cast&) noexcept; + bad_cast& operator=(const bad_cast&) noexcept; + virtual ~bad_cast(); + virtual const char* what() const noexcept; }; /** @@ -74,21 +74,21 @@ namespace std class bad_typeid: public exception { public: - bad_typeid() noexcept; - bad_typeid(const bad_typeid &__rhs) noexcept; - virtual ~bad_typeid(); - bad_typeid& operator=(const bad_typeid &__rhs) noexcept; - virtual const char* what() const noexcept; + bad_typeid() noexcept; + bad_typeid(const bad_typeid &__rhs) noexcept; + virtual ~bad_typeid(); + bad_typeid& operator=(const bad_typeid &__rhs) noexcept; + virtual const char* what() const noexcept; }; class bad_array_new_length: public bad_alloc { public: - bad_array_new_length() noexcept; - bad_array_new_length(const bad_array_new_length&) noexcept; - bad_array_new_length& operator=(const bad_array_new_length&) noexcept; + bad_array_new_length() noexcept; + bad_array_new_length(const bad_array_new_length&) noexcept; + bad_array_new_length& operator=(const bad_array_new_length&) noexcept; virtual ~bad_array_new_length(); - virtual const char *what() const noexcept; + virtual const char *what() const noexcept; }; |