diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-04 15:38:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-04 15:38:52 +0300 |
commit | d0da3a7489670a202901ac32ca6e4bffb16d485b (patch) | |
tree | 77a04d9e7f318a171eb51289f82e16975c17e93d /src/utils/checkutils.h | |
parent | 972a7923355b87f7570bae37306d9ec8121c86da (diff) | |
download | plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.gz plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.bz2 plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.xz plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.zip |
Add macroses returnFalseV, returnTrueV, returnFalse, returnTrue.
Diffstat (limited to 'src/utils/checkutils.h')
-rw-r--r-- | src/utils/checkutils.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index fea0a0f67..713ac305f 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -35,6 +35,38 @@ #define failTrue(val) \ failTrueReal(val, #val, __FILE__, __LINE__, __func__) +#define returnFalseV(val) \ + if (!val) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val); \ + return; \ + } + +#define returnTrueV(val) \ + if (val) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected true value", #val); \ + return; \ + } + +#define returnFalse(ret, val) \ + if (!val) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected false value", #val); \ + return ret; \ + } + +#define returnTrue(ret, val) \ + if (val) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected true value", #val); \ + return ret; \ + } + bool reportFalseReal(const bool val, const char *const text, const char *const file, @@ -71,6 +103,10 @@ void reportStack(const char *const file, #define reportTrue(val) (val) #define failFalse(val) (val) #define failTrue(val) (val) +#define returnTrueV(val) +#define returnFalseV(val) +#define returnTrue(val) +#define returnFalse(val) #endif // ENABLE_ASSERTS #endif // UTILS_CHECKUTILS_H |