From 0df7936ea50db2ee5680f75fa285f96fedf1f341 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 29 Feb 2024 12:00:58 -0500 Subject: 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. --- indra/test/debug.h | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'indra/test') 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 // 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 @@ -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) */ -- cgit v1.2.3