Undo magic-statification of message id counter

This commit is contained in:
Martin Hořeňovský
2025-12-02 10:51:42 +01:00
parent 24e305b83e
commit 036448b4b2

View File

@@ -15,10 +15,7 @@ namespace Catch {
// Messages are owned by their individual threads, so the counter should // Messages are owned by their individual threads, so the counter should
// be thread-local as well. Alternative consideration: atomic counter, // be thread-local as well. Alternative consideration: atomic counter,
// so threads don't share IDs and things are easier to debug. // so threads don't share IDs and things are easier to debug.
static unsigned int GetNextMessageID() { static CATCH_INTERNAL_THREAD_LOCAL unsigned int messageIDCounter = 0;
static CATCH_INTERNAL_THREAD_LOCAL unsigned int counter = 0;
return ++counter;
}
} }
MessageInfo::MessageInfo( StringRef _macroName, MessageInfo::MessageInfo( StringRef _macroName,
@@ -27,7 +24,7 @@ namespace Catch {
: macroName( _macroName ), : macroName( _macroName ),
lineInfo( _lineInfo ), lineInfo( _lineInfo ),
type( _type ), type( _type ),
sequence( GetNextMessageID() ) sequence( ++messageIDCounter )
{} {}
} // end namespace Catch } // end namespace Catch