summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-11 19:23:27 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-11 19:23:27 +0300
commitdbcbc901992ec3a54ec3a1730029b25d94d679b1 (patch)
treee920682021dea0a2a93e6a6c0365dacd272437cc /src/utils/checkutils.h
parentb330124c19e089cdaf7c91a9103f8bce14d8479e (diff)
downloadmanaplus-dbcbc901992ec3a54ec3a1730029b25d94d679b1.tar.gz
manaplus-dbcbc901992ec3a54ec3a1730029b25d94d679b1.tar.bz2
manaplus-dbcbc901992ec3a54ec3a1730029b25d94d679b1.tar.xz
manaplus-dbcbc901992ec3a54ec3a1730029b25d94d679b1.zip
Add reportAlways macroses in xml load errors.
Diffstat (limited to 'src/utils/checkutils.h')
-rw-r--r--src/utils/checkutils.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h
index 7316264b2..18f958d8d 100644
--- a/src/utils/checkutils.h
+++ b/src/utils/checkutils.h
@@ -31,9 +31,12 @@
(val ? (reportAssertStack(__FILE__, __LINE__, __func__, \
"Detected false value", #val), true) : false)
-#define reportAlwaysReal(val) \
- reportAssertStack(__FILE__, __LINE__, __func__, \
- "Always assert", val);
+#define reportAlwaysReal(...) \
+ { \
+ logger->assertLog( \
+ __VA_ARGS__); \
+ reportLogStack(__FILE__, __LINE__, __func__); \
+ }
#define returnFalseVReal(val) \
if (!val) \
@@ -141,10 +144,11 @@
throw new std::exception(); \
}
-#define failAlways(val) \
+#define failAlways(...) \
{ \
- reportAssertStack(__FILE__, __LINE__, __func__, \
- "Detected false value", val); \
+ logger->assertLog( \
+ __VA_ARGS__); \
+ reportLogStack(__FILE__, __LINE__, __func__); \
throw new std::exception(); \
}
@@ -156,9 +160,7 @@ void reportAssertStack(const char *const file,
void reportLogStack(const char *const file,
const unsigned int line,
- const char *const func,
- const char *const name,
- const char *const text);
+ const char *const func);
void reportStack();
@@ -167,7 +169,7 @@ void reportStack();
#define reportFalseReal(val) (val)
#define reportTrueReal(val) (val)
-#define reportAlwaysReal(val) ;
+#define reportAlwaysReal(...) ;
#define returnFalseVReal(val) \
if (!val) \
@@ -220,14 +222,14 @@ void reportStack();
if ((val) == nullptr) \
return ret;
-#define failAlways(val) ;
+#define failAlways(...) ;
#endif // ENABLE_ASSERTS
#ifdef UNITTESTS
#define reportFalse(val) failFalse(val)
#define reportTrue(val) failTrue(val)
-#define reportAlways(val) failAlways(val)
+#define reportAlways(...) failAlways(__VA_ARGS__)
#define returnFalseV(val) returnFailFalseV(val)
#define returnTrueV(val) returnFailTrueV(val)
#define returnFalse(ret, val) returnFailFalse(ret, val)
@@ -237,7 +239,7 @@ void reportStack();
#else // UNITTESTS
#define reportFalse(val) reportFalseReal(val)
#define reportTrue(val) reportTrueReal(val)
-#define reportAlways(val) reportAlwaysReal(val)
+#define reportAlways(...) reportAlwaysReal(__VA_ARGS__)
#define returnFalseV(val) returnFalseVReal(val)
#define returnTrueV(val) returnTrueVReal(val)
#define returnFalse(ret, val) returnFalseReal(ret, val)