diff options
| author | Martin Hořeňovský | 2026-04-07 13:09:51 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-04-07 14:28:11 +0200 |
| commit | 3ab0d7cef3313d91e652a89870c89b0c42760f9e (patch) | |
| tree | 5cd6042b65dc6cf5c524edd3a42dea99194533fc /src/catch2/internal/catch_run_context.cpp | |
| parent | e83218c2dfdf80fd53526fe389c0a3271696a106 (diff) | |
| download | catch3-3ab0d7cef3313d91e652a89870c89b0c42760f9e.tar.gz | |
Turn IResultCapture::{push,pop}*Message into free functions
The thread-safety changes in assertions & messages turned the message
stacks into thread-local state, instead of it being member of `RunContext`.
The relevant {push,pop}(Un)ScopedMessage functions were turned from member
functions into static functions, but this left `catch_message.hpp` with
dependency on `IResultCapture`'s definition for the functions, and thus
it still had to include `catch_interfaces_capture.hpp`.
With this change, `catch_message.hpp` no longer needs
`catch_interfaces_capture.hpp`.
Diffstat (limited to 'src/catch2/internal/catch_run_context.cpp')
| -rw-r--r-- | src/catch2/internal/catch_run_context.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index fd4b7a38..125ffc7b 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -308,6 +308,22 @@ namespace Catch { } CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + + void pushScopedMessage( MessageInfo&& message ) { + Detail::g_messageHolder().addScopedMessage( CATCH_MOVE( message ) ); + } + + void popScopedMessage( unsigned int messageId ) { + Detail::g_messageHolder().removeMessage( messageId ); + } + + void emplaceUnscopedMessage( MessageBuilder&& builder ) { + Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( builder ) ); + } + + void addUnscopedMessage( MessageInfo&& message ) { + Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( message ) ); + } } // namespace Detail RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter) @@ -937,21 +953,6 @@ namespace Catch { } } - void IResultCapture::pushScopedMessage( MessageInfo&& message ) { - Detail::g_messageHolder().addScopedMessage( CATCH_MOVE( message ) ); - } - - void IResultCapture::popScopedMessage( unsigned int messageId ) { - Detail::g_messageHolder().removeMessage( messageId ); - } - - void IResultCapture::emplaceUnscopedMessage( MessageBuilder&& builder ) { - Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( builder ) ); - } - - void IResultCapture::addUnscopedMessage( MessageInfo&& message ) { - Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( message ) ); - } void seedRng(IConfig const& config) { sharedRng().seed(config.rngSeed()); |