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/llcommon/tests/lleventcoro_test.cpp | 20 ++++++++++---------- indra/test/debug.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 032923a108..c7a958da49 100644 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -113,7 +113,7 @@ namespace tut void test_data::explicit_wait(boost::shared_ptr>& cbp) { - BEGIN + DEBUGIN { mSync.bump(); // The point of this test is to verify / illustrate suspending a @@ -136,7 +136,7 @@ namespace tut mSync.bump(); ensure_equals("Got it", stringdata, "received"); } - END + DEBUGEND } template<> template<> @@ -163,13 +163,13 @@ namespace tut void test_data::waitForEventOn1() { - BEGIN + DEBUGIN { mSync.bump(); result = suspendUntilEventOn("source"); mSync.bump(); } - END + DEBUGEND } template<> template<> @@ -189,7 +189,7 @@ namespace tut void test_data::coroPump() { - BEGIN + DEBUGIN { mSync.bump(); LLCoroEventPump waiter; @@ -197,7 +197,7 @@ namespace tut result = waiter.suspend(); mSync.bump(); } - END + DEBUGEND } template<> template<> @@ -217,7 +217,7 @@ namespace tut void test_data::postAndWait1() { - BEGIN + DEBUGIN { mSync.bump(); result = postAndSuspend(LLSDMap("value", 17), // request event @@ -226,7 +226,7 @@ namespace tut "reply"); // request["reply"] = name mSync.bump(); } - END + DEBUGEND } template<> template<> @@ -240,7 +240,7 @@ namespace tut void test_data::coroPumpPost() { - BEGIN + DEBUGIN { mSync.bump(); LLCoroEventPump waiter; @@ -248,7 +248,7 @@ namespace tut immediateAPI.getPump(), "reply"); mSync.bump(); } - END + DEBUGEND } template<> template<> 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