From 181b0f4377246ea215edc9fdab37d4345882cdf3 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Wed, 18 Aug 2021 21:36:16 +0300 Subject: [PATCH] Update SqBase.hpp --- module/SqBase.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/module/SqBase.hpp b/module/SqBase.hpp index 3c4d0244..c2842ba6 100644 --- a/module/SqBase.hpp +++ b/module/SqBase.hpp @@ -506,6 +506,26 @@ enum EntityType #define SQMOD_NODISCARD #endif +/* ------------------------------------------------------------------------------------------------ + * DEBUG SELECTION +*/ +#ifdef _DEBUG + #define SQMOD_DEBUG_ONLY(X) X + #define SQMOD_EXCEPT_DEBUG(X) + #define SQMOD_RELEASE_ONLY(X) + #define SQMOD_EXCEPT_RELEASE(X) X + #define SQMOD_RTFMT(X) fmt::runtime(X) +#else + #define SQMOD_DEBUG_ONLY(X) + #define SQMOD_EXCEPT_DEBUG(X) X + #define SQMOD_RELEASE_ONLY(X) X + #define SQMOD_EXCEPT_RELEASE(X) + #define SQMOD_RTFMT(X) X +#endif + +#define SQMOD_DEBUG_OR(D, R) SQMOD_DEBUG_ONLY(D) SQMOD_EXCEPT_DEBUG(R) +#define SQMOD_RELEASE_OR(R, D) SQMOD_RELEASE_ONLY(R) SQMOD_EXCEPT_RELEASE(D) + /* ------------------------------------------------------------------------------------------------ * LOGGING LOCATION */ @@ -525,7 +545,7 @@ enum EntityType #if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) #define STHROW(e, m, ...) throw e(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) - #define STHROWF(m, ...) SqThrowF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) + #define STHROWF(m, ...) SqThrowF(fmt::runtime(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] "), ##__VA_ARGS__) #define STHROWLASTF(m, ...) SqThrowLastF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) #else #define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__)