diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-02-29 12:00:58 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-02-29 12:00:58 -0500 |
commit | 0df7936ea50db2ee5680f75fa285f96fedf1f341 (patch) | |
tree | 9b1f03a5454f0b979561636bd867f18123d4d1b6 /indra/test | |
parent | 777586a1865b496f8bfea9651afbd481ea23b4f7 (diff) |
Improve Debug class (indra/test/debug.h).
Disable copy assignment operator as well as copy constructor.
Use std::uncaught_exceptions() in destructor to report whether there's an
in-flight exception at block exit. Since that was the whole point of the
DEBUGIN / DEBUGEND macros, those become obsolete. Ditch them and their
existing invocations.
Diffstat (limited to 'indra/test')
-rw-r--r-- | indra/test/debug.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/indra/test/debug.h b/indra/test/debug.h index f92cce3008..3c4f3cabb4 100644 --- a/indra/test/debug.h +++ b/indra/test/debug.h @@ -31,6 +31,7 @@ #include "print.h" #include "stringize.h" +#include <exception> // std::uncaught_exceptions() /***************************************************************************** * Debugging stuff @@ -65,10 +66,12 @@ public: // non-copyable Debug(const Debug&) = delete; + Debug& operator=(const Debug&) = delete; ~Debug() { - (*this)("exit"); + auto exceptional{ std::uncaught_exceptions()? "exceptional " : "" }; + (*this)(exceptional, "exit"); } template <typename... ARGS> @@ -90,20 +93,4 @@ private: // of the Debug block. #define DEBUG Debug debug(LL_PRETTY_FUNCTION) -// These DEBUGIN/DEBUGEND macros are specifically for debugging output -- -// please don't assume you must use such for coroutines in general! They only -// help to make control flow (as well as exception exits) explicit. -#define DEBUGIN \ -{ \ - DEBUG; \ - try - -#define DEBUGEND \ - catch (...) \ - { \ - debug("*** exceptional "); \ - throw; \ - } \ -} - #endif /* ! defined(LL_DEBUG_H) */ |