From 933f96fbc5ec6e0490cd825456a79a09c2105487 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Tue, 22 Mar 2016 16:54:40 +0200 Subject: [PATCH] Add the exception throwing macros to the base module header as well. --- shared/ModBase.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/shared/ModBase.hpp b/shared/ModBase.hpp index 26f77633..b09ed217 100644 --- a/shared/ModBase.hpp +++ b/shared/ModBase.hpp @@ -275,6 +275,31 @@ using namespace Sqrat; #define SQMOD_FORCEINLINE inline #endif +/* ------------------------------------------------------------------------------------------------ + * LOGGING LOCATION +*/ + +#define SQMOD_TRUESTRINGIZE(x) #x +#define SQMOD_STRINGIZEWRAP(x) SQMOD_TRUESTRINGIZE(x) + +#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) + #define SQMOD_MSGLOC(m) (m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ") +#else + #define SQMOD_MSGLOC(m) (m) +#endif // _DEBUG + +/* ------------------------------------------------------------------------------------------------ + * EXCEPTION THROWING +*/ + +#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__) +#else + #define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__) + #define STHROWF(m, ...) SqThrowF(m, ##__VA_ARGS__) +#endif // _DEBUG + /* ------------------------------------------------------------------------------------------------ * VARIOUS DEFINES */