mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-23 13:56:11 +01:00
0614a4acb3
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.
24 lines
664 B
C++
24 lines
664 B
C++
/*
|
|
* Created by Josh on 1/2/2018.
|
|
* Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
|
|
*
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
|
|
#include "catch_compiler_capabilities.h"
|
|
#include "catch_uncaught_exceptions.h"
|
|
#include <exception>
|
|
|
|
namespace Catch {
|
|
bool 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();
|
|
#endif
|
|
}
|
|
} // end namespace Catch
|