Hide std::exception_ptr and friends if exceptions disabled

Some compilers, e.g. the Green Hills C++ compiler, react badly to the
appearance of std::exception_ptr, std::current_exception,
std::rethrow_exception and std::uncaught_exception(s). To allow usage of
Catch2 with these compilers when exceptions are disabled, hide the usage
of std::exception_ptr etc. when compiling with
CATCH_CONFIG_DISABLE_EXCEPTIONS.
This commit is contained in:
Matthias Blankertz
2020-06-04 11:53:13 +02:00
committed by Martin Hořeňovský
parent 0f12995501
commit 0614a4acb3
4 changed files with 11 additions and 1 deletions

View File

@@ -12,7 +12,9 @@
namespace Catch {
bool uncaught_exceptions() {
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
return false;
#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
return std::uncaught_exceptions() > 0;
#else
return std::uncaught_exception();