From 62813629db182aa7098c6ab6fe63c304c2c729b0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 4 May 2016 17:40:40 +0300 Subject: Move most checkutils functions into macroses. --- src/utils/checkutils.h | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'src/utils/checkutils.h') diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index 713ac305f..9617ca140 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -24,16 +24,22 @@ #ifdef ENABLE_ASSERTS #define reportFalse(val) \ - reportFalseReal(val, #val, __FILE__, __LINE__, __func__) + (val ? true : (reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val), false)) #define reportTrue(val) \ - reportTrueReal(val, #val, __FILE__, __LINE__, __func__) + (val ? (reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val), true) : false) #define failFalse(val) \ - failFalseReal(val, #val, __FILE__, __LINE__, __func__) + (val ? true : (reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val), \ + throw new std::exception(), false)) #define failTrue(val) \ - failTrueReal(val, #val, __FILE__, __LINE__, __func__) + (val ? (reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val), \ + throw new std::exception(), true) : false) #define returnFalseV(val) \ if (!val) \ @@ -67,30 +73,6 @@ return ret; \ } -bool reportFalseReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func); - -bool reportTrueReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func); - -bool failFalseReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func); - -bool failTrueReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func); - void reportStack(const char *const file, const unsigned int line, const char *const func, -- cgit v1.2.3-70-g09d2