mirror of
https://github.com/catchorg/Catch2.git
synced 2025-12-16 07:02:12 +01:00
Undo magic-statification of message id counter
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user