From d463dc007445af010e1fa3fa6b66c3c561ef28b4 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 5 Oct 2015 17:47:23 +0000 Subject: [PATCH] Add std::uncaught_exceptions() to libcxxrt (C++17, see N4152 and N4259). This has also been submitted upstream. --- contrib/libcxxrt/exception.cc | 9 +++++++++ lib/libcxxrt/Version.map | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index c559f97ed948..052541f58ee8 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -1473,6 +1473,15 @@ namespace std __cxa_thread_info *info = thread_info(); return info->globals.uncaughtExceptions != 0; } + /** + * Returns the number of exceptions currently being thrown that have not + * been caught. This can occur inside a nested catch statement. + */ + int uncaught_exceptions() throw() + { + __cxa_thread_info *info = thread_info(); + return info->globals.uncaughtExceptions; + } /** * Returns the current unexpected handler. */ diff --git a/lib/libcxxrt/Version.map b/lib/libcxxrt/Version.map index 9767542138ff..b825eaa4b14c 100644 --- a/lib/libcxxrt/Version.map +++ b/lib/libcxxrt/Version.map @@ -356,3 +356,9 @@ GLIBCXX_3.4.9 { }; } GLIBCXX_3.4; +GLIBCXX_3.4.22 { + extern "C++" { + "std::uncaught_exceptions()"; + }; +} GLIBCXX_3.4.9; +