diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/checkutils.cpp | 50 | ||||
-rw-r--r-- | src/utils/checkutils.h | 38 |
2 files changed, 10 insertions, 78 deletions
diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp index 3161c8f46..5efda43f5 100644 --- a/src/utils/checkutils.cpp +++ b/src/utils/checkutils.cpp @@ -30,56 +30,6 @@ #include "debug.h" -bool reportFalseReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func) -{ - if (!val) - reportStack(file, line, func, "Detected false value", text); - return val; -} - -bool reportTrueReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func) -{ - if (val) - reportStack(file, line, func, "Detected true value", text); - return val; -} - -bool failFalseReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func) -{ - if (!val) - { - reportStack(file, line, func, "Detected false value", text); - throw new std::exception; - } - return val; -} - -bool failTrueReal(const bool val, - const char *const text, - const char *const file, - const unsigned line, - const char *const func) -{ - if (val) - { - reportStack(file, line, func, "Detected true value", text); - throw new std::exception; - } - return val; -} - void reportStack(const char *const file, const unsigned int line, const char *const func, 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, |