Fix disengage failure logs for FatalConditionHandlerGuard

FatalConditionHandlerGuard is used within RunContext::invokeActiveTestCase().
The intent of this guard is to avoid binary crash without failed test being
reported.
Still in case FatalConditionHandlerGuard destructor being called during stack
unwinding AND finds unexpected top-level filter for SEH unhandled exception,
the binary may still crash. As result of such crash the original exception
details are being hidden.

As the Catch2 provides only `CATCH_CATCH_ANON` macro, with no access to
exception details by design, looks like the best way to handle issue is to:
 - state requirements explicitly by `noexcept` specifier
 - use `Catch::cerr()` to print out possible issue notification

Signed-off-by: Kochetkov, Yuriy <yuriyx.kochetkov@intel.com>
This commit is contained in:
Kochetkov, Yuriy 2022-02-08 13:43:40 +03:00 committed by Martin Hořeňovský
parent 7882f7359e
commit 2ce64d1d8f
2 changed files with 9 additions and 7 deletions

View file

@ -32,7 +32,7 @@ namespace Catch {
// Should be if-defed to work on current platform, can assume
// engage-disengage 1:1 pairing.
void engage_platform();
void disengage_platform();
void disengage_platform() noexcept;
public:
// Should also have platform-specific implementations as needed
FatalConditionHandler();
@ -44,7 +44,7 @@ namespace Catch {
engage_platform();
}
void disengage() {
void disengage() noexcept {
assert(m_started && "Handler cannot be uninstalled without being installed first");
m_started = false;
disengage_platform();