// Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) 2016-2019 Jason Volk // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice is present in all copies. The // full license for this software is available in the LICENSE file. #include uncaughtExceptions; } #else #warning "CXXABI not available. Context switch with uncaught exceptions may be unsafe!" uint ircd::ctx::exception_handler::uncaught_exceptions() noexcept { return std::uncaught_exceptions(); } #endif #ifdef HAVE_CXXABI_H /// Set the uncaught exception count and return the previous value. uint ircd::ctx::exception_handler::uncaught_exceptions(const uint &val) noexcept { const auto &cxa_globals { __cxxabiv1::__cxa_get_globals_fast() }; assert(cxa_globals); const auto ret { cxa_globals->uncaughtExceptions }; assert(unsigned(ret) == unsigned(std::uncaught_exceptions())); cxa_globals->uncaughtExceptions = val; return ret; } #else #warning "CXXABI not available. Context switch with uncaught exceptions may be unsafe!" uint ircd::ctx::exception_handler::uncaught_exceptions(const uint &val) noexcept { assert(std::uncaught_exceptions() == val); return std::uncaught_exceptions(); } #endif