From 4029b40e800eb8654e6896576c521137835c55e2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 Apr 2016 00:18:11 +0300 Subject: Move report defines from debug.h into checkutils.h --- src/debug.h | 12 ------------ src/utils/checkutils.cpp | 4 ++++ src/utils/checkutils.h | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/debug.h b/src/debug.h index 6cbd61941..8e207abf5 100644 --- a/src/debug.h +++ b/src/debug.h @@ -27,20 +27,8 @@ // #define _DEBUG_NEW_EMULATE_MALLOC 1 #include "debug/debug_new.h" -#define reportFalse(val) reportFalse1(val, __FILE__, __LINE__) -#define reportFalse1(val, file, line) reportFalseReal(val, file, line) - -#define reportTrue(val) reportTrue1(val, __FILE__, __LINE__) -#define reportTrue1(val, file, line) reportTrueReal(val, file, line) - -#else // ENABLE_MEM_DEBUG - -#define reportFalse(val) (val) -#define reportTrue(val) (val) - #endif // ENABLE_MEM_DEBUG - #ifdef DEBUG_SDL_SURFACES #define MIMG_LoadPNG_RW(src) FakeIMG_LoadPNG_RW(src, __FILE__, __LINE__) diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp index 7b30b347a..8aa82bc11 100644 --- a/src/utils/checkutils.cpp +++ b/src/utils/checkutils.cpp @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#ifdef ENABLE_ASSERTS + #include "utils/checkutils.h" #include "logger.h" @@ -39,3 +41,5 @@ bool reportTrueReal(const bool val, const char *const file, logger->log("Debug: true value at %s:%u", file, line); return val; } + +#endif // ENABLE_ASSERTS diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index 8cd9a3ad5..ce4fcdc61 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -21,10 +21,24 @@ #ifndef UTILS_CHECKUTILS_H #define UTILS_CHECKUTILS_H +#ifdef ENABLE_ASSERTS + +#define reportFalse(val) reportFalse1(val, __FILE__, __LINE__) +#define reportFalse1(val, file, line) reportFalseReal(val, file, line) + +#define reportTrue(val) reportTrue1(val, __FILE__, __LINE__) +#define reportTrue1(val, file, line) reportTrueReal(val, file, line) + bool reportFalseReal(const bool val, const char *const file, const unsigned line); bool reportTrueReal(const bool val, const char *const file, const unsigned line); +#else // ENABLE_ASSERTS + +#define reportFalse(val) (val) +#define reportTrue(val) (val) + +#endif // ENABLE_ASSERTS #endif // UTILS_CHECKUTILS_H -- cgit v1.2.3-60-g2f50