From ca2d925c63fc5b7c3840163fffd2eef35ed6d1ea Mon Sep 17 00:00:00 2001 From: Iliyas Jorio Date: Mon, 28 Dec 2020 16:25:56 +0100 Subject: [PATCH] Non-fatal todo messages only shown with _DEBUG --- src/PommeDebug.h | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/PommeDebug.h b/src/PommeDebug.h index b16b5b3..480a24b 100644 --- a/src/PommeDebug.h +++ b/src/PommeDebug.h @@ -31,21 +31,33 @@ void ImplementMe(const char* fn, std::string msg, int severity); ImplementMe(__func__, ss.str(), severity); \ } -#define TODOMINOR() TODOCUSTOM("", 0) -#define TODOMINOR2(x) TODOCUSTOM(x, 0) -#define TODO() TODOCUSTOM("", 1) -#define TODO2(x) TODOCUSTOM(x, 1) #define TODOFATAL() TODOCUSTOM("", 2) #define TODOFATAL2(x) TODOCUSTOM(x, 2) -#define ONCE(x) { \ - static bool once = false; \ - if (!once) { \ - once = true; \ - {x} \ - printf(" \x1b[90m\\__ this todo won't be shown again\x1b[0m\n"); \ - } \ -} +#if _DEBUG + #define TODOMINOR() TODOCUSTOM("", 0) + #define TODOMINOR2(x) TODOCUSTOM(x, 0) + #define TODO() TODOCUSTOM("", 1) + #define TODO2(x) TODOCUSTOM(x, 1) -#endif + #define ONCE(x) { \ + static bool once = false; \ + if (!once) { \ + once = true; \ + {x} \ + printf(" \x1b[90m\\__ this todo won't be shown again\x1b[0m\n"); \ + } \ + } + +#else + + #define TODOMINOR() {} + #define TODOMINOR2(x) {} + #define TODO() {} + #define TODO2(x) {} + #define ONCE(x) {x} + +#endif // _DEBUG + +#endif // __cplusplus