summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-04 17:40:40 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-04 17:40:40 +0300
commit62813629db182aa7098c6ab6fe63c304c2c729b0 (patch)
tree8a9463be90ae072e83e4adab80c424d8b419b5bb /src/utils/checkutils.h
parentd0da3a7489670a202901ac32ca6e4bffb16d485b (diff)
downloadmanaverse-62813629db182aa7098c6ab6fe63c304c2c729b0.tar.gz
manaverse-62813629db182aa7098c6ab6fe63c304c2c729b0.tar.bz2
manaverse-62813629db182aa7098c6ab6fe63c304c2c729b0.tar.xz
manaverse-62813629db182aa7098c6ab6fe63c304c2c729b0.zip
Move most checkutils functions into macroses.
Diffstat (limited to 'src/utils/checkutils.h')
-rw-r--r--src/utils/checkutils.h38
1 files changed, 10 insertions, 28 deletions
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,