From e993b7973510449147db9ac630bff95197a03aff Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 23 Feb 2024 09:57:26 -0500 Subject: Allow variadic instances of Debug, e.g. to display arguments. All Debug constructor args are concatenated using stringize(). --- indra/test/debug.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/test/debug.h') diff --git a/indra/test/debug.h b/indra/test/debug.h index 76dbb973b2..162cd3da64 100644 --- a/indra/test/debug.h +++ b/indra/test/debug.h @@ -30,6 +30,7 @@ #define LL_DEBUG_H #include "print.h" +#include "stringize.h" /***************************************************************************** * Debugging stuff @@ -52,8 +53,9 @@ class Debug { public: - Debug(const std::string& block): - mBlock(block), + template + Debug(ARGS&&... args): + mBlock(stringize(std::forward(args)...)), mLOGTEST(getenv("LOGTEST")), // debug output enabled when LOGTEST is set AND non-empty mEnabled(mLOGTEST && *mLOGTEST) -- cgit v1.2.3 From 904d82402c8b927f5e09830d10247079fb4a94f4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 23 Feb 2024 10:11:21 -0500 Subject: Allow debug.h to be #included even in normal viewer code. debug.h #defines a couple of macros intended to enclose the entire body of a function to track its entry and (possibly exceptional) exit. The trouble is that these macros used to be called BEGIN and END, which is far too generic -- especially considering that END is used as an enum value in some parts of the viewer. Rename them DEBUGIN and DEBUGEND, which is ugly but unlikely to collide with anything else. --- indra/test/debug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/test/debug.h') diff --git a/indra/test/debug.h b/indra/test/debug.h index 162cd3da64..f92cce3008 100644 --- a/indra/test/debug.h +++ b/indra/test/debug.h @@ -90,15 +90,15 @@ private: // of the Debug block. #define DEBUG Debug debug(LL_PRETTY_FUNCTION) -// These BEGIN/END 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 BEGIN \ +// 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 END \ +#define DEBUGEND \ catch (...) \ { \ debug("*** exceptional "); \ -- cgit v1.2.3