diff options
author | dtorilov <dtorilov@yandex-team.com> | 2023-05-24 16:49:46 +0300 |
---|---|---|
committer | dtorilov <dtorilov@yandex-team.com> | 2023-05-24 16:49:46 +0300 |
commit | b7adcd4bdb1fcd9a79dc74c411e9812ebca574e4 (patch) | |
tree | ba95aa8c9cc988009baa060076db6c17488fc035 /contrib/libs/cxxsupp/libcxx/src | |
parent | 5284e74c027f3cf50fc29ceb5fd3d43b4729921b (diff) | |
download | ydb-b7adcd4bdb1fcd9a79dc74c411e9812ebca574e4.tar.gz |
YT-19142: Add emscripten patches to libcxx
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/src/new.cpp | 9 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_fallback.ipp | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/new.cpp b/contrib/libs/cxxsupp/libcxx/src/new.cpp index b7e28281585..136084809de 100644 --- a/contrib/libs/cxxsupp/libcxx/src/new.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/new.cpp @@ -73,8 +73,17 @@ operator new(std::size_t size) _THROW_BAD_ALLOC #ifndef _LIBCPP_NO_EXCEPTIONS throw std::bad_alloc(); #else +#ifdef __EMSCRIPTEN__ + // Abort here so that when exceptions are disabled, we do not just + // return 0 when malloc returns 0. + // We could also do this with set_new_handler, but that adds a + // global constructor and a table entry, overhead that we can avoid + // by doing it this way. + abort(); +#else break; #endif +#endif } return p; } diff --git a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_fallback.ipp b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_fallback.ipp index a45f11eb9f5..ebdca7e5ee2 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_fallback.ipp +++ b/contrib/libs/cxxsupp/libcxx/src/support/runtime/exception_fallback.ipp @@ -48,6 +48,7 @@ get_terminate() noexcept return __libcpp_atomic_load(&__terminate_handler); } +#ifndef __EMSCRIPTEN__ // We provide this in JS _LIBCPP_NORETURN void terminate() noexcept @@ -70,7 +71,9 @@ terminate() noexcept } #endif // _LIBCPP_NO_EXCEPTIONS } +#endif // !__EMSCRIPTEN__ +#if !defined(__EMSCRIPTEN__) bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; } int uncaught_exceptions() noexcept @@ -79,6 +82,7 @@ int uncaught_exceptions() noexcept fprintf(stderr, "uncaught_exceptions not yet implemented\n"); ::abort(); } +#endif // !__EMSCRIPTEN__ exception::~exception() noexcept |