Browse Source

Avoid spurious reinitialization in TestState

master
Jacob Bachmeyer 3 years ago
parent
commit
ac0996ca90
  1. 3
      ChangeLog
  2. 7
      dejagnu.h

3
ChangeLog

@ -1,5 +1,8 @@
2022-11-30 Jacob Bachmeyer <jcb@gnu.org>
* dejagnu.h (TestState::TestState): Only perform initialization
when the first TestState object is constructed.
* dejagnu.h (DG__endmsg): New function, called using atexit().
(endmsg_registered, TestState_count): Add fields to DG__status.
(DG__init): New function, to register DG__endmsg.

7
dejagnu.h

@ -218,6 +218,12 @@ class TestState {
public:
TestState (void)
{
DG__status.TestState_count++;
if (DG__status.TestState_count > 1)
return; /* Do not clear the counters if additional TestState
objects are constructed. */
DG__status.pass = 0;
DG__status.fail = 0;
DG__status.xpass = 0;
@ -228,7 +234,6 @@ class TestState {
/* C++ object destruction will substitute for atexit(). */
DG__status.endmsg_registered = 1;
DG__status.TestState_count++;
}
~TestState (void)

Loading…
Cancel
Save