aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/glibcxx_eh_cxx17.cpp
blob: 5e5ad083ba91d2d5da6712e145bded678140f9bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
    }
}