summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-04 15:38:52 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-04 15:38:52 +0300
commitd0da3a7489670a202901ac32ca6e4bffb16d485b (patch)
tree77a04d9e7f318a171eb51289f82e16975c17e93d /src/utils/checkutils.h
parent972a7923355b87f7570bae37306d9ec8121c86da (diff)
downloadmv-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.gz
mv-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.bz2
mv-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.xz
mv-d0da3a7489670a202901ac32ca6e4bffb16d485b.zip
Add macroses returnFalseV, returnTrueV, returnFalse, returnTrue.
Diffstat (limited to 'src/utils/checkutils.h')
-rw-r--r--src/utils/checkutils.h36
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