Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_registry_hub.cpp
diff options
context:
space:
mode:
authorMatthias Blankertz2020-06-04 11:53:13 +0200
committerMartin Hořeňovský2020-07-22 21:18:47 +0200
commit9221a6ff653a4f4c6f981675122064da7d7b356d (patch)
tree0af57d152c5489a7399f3a02c071a5ed03dddf32 /src/catch2/catch_registry_hub.cpp
parent657ebf5db2b4df1f6f6404cb3363408cce8ba6c2 (diff)
downloadcatch3-9221a6ff653a4f4c6f981675122064da7d7b356d.tar.gz
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.
Diffstat (limited to 'src/catch2/catch_registry_hub.cpp')
-rw-r--r--src/catch2/catch_registry_hub.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/catch2/catch_registry_hub.cpp b/src/catch2/catch_registry_hub.cpp
index ed2d068a..a8860e3a 100644
--- a/src/catch2/catch_registry_hub.cpp
+++ b/src/catch2/catch_registry_hub.cpp
@@ -9,6 +9,7 @@
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_context.hpp>
+#include <catch2/internal/catch_enforce.hpp>
#include <catch2/internal/catch_test_case_registry_impl.hpp>
#include <catch2/internal/catch_reporter_registry.hpp>
#include <catch2/internal/catch_exception_translator_registry.hpp>
@@ -59,7 +60,11 @@ namespace Catch {
m_tagAliasRegistry.add( alias, tag, lineInfo );
}
void registerStartupException() noexcept override {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
m_exceptionRegistry.add(std::current_exception());
+#else
+ CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
+#endif
}
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
return m_enumValuesRegistry;