summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp
diff options
context:
space:
mode:
authorDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp')
-rw-r--r--contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp b/contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp
new file mode 100644
index 00000000000..5e5ad083ba9
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp
@@ -0,0 +1,17 @@
+#include <cxxabi.h>
+
+/**
+ * libc++ expects std::uncaught_exceptions() to be provided by C++ runtime library.
+ *
+ * GCC versions prior to GCC 6 did not provide this function yet, but it can be
+ * implemented using its API.
+ *
+ * This implementation should cover ubuntu-12, ubuntu-14, ubuntu-16.
+ */
+
+namespace std {
+ int uncaught_exceptions() noexcept {
+ const auto* globals{__cxxabiv1::__cxa_get_globals()};
+ return static_cast<int>(globals->uncaughtExceptions);
+ }
+}