summaryrefslogtreecommitdiffstats
path: root/src/Globals.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-30 10:56:12 +0200
committermadmaxoft <github@xoft.cz>2014-05-30 10:56:12 +0200
commit0b60caac4ae8e7762cc530a0a7b6a7abe8c33262 (patch)
tree4b447f45fc2eaac95013014d12383788483c3a7e /src/Globals.h
parentFixed sign comparison. (diff)
downloadcuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar.gz
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar.bz2
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar.lz
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar.xz
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.tar.zst
cuberite-0b60caac4ae8e7762cc530a0a7b6a7abe8c33262.zip
Diffstat (limited to 'src/Globals.h')
-rw-r--r--src/Globals.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Globals.h b/src/Globals.h
index 85cfd2f18..7b7a34541 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -271,9 +271,25 @@ void inline LOGERROR(const char* a_Format, ...)
{
};
+ #ifdef _WIN32
+ #define REPORT_ERROR(FMT, ...) \
+ { \
+ AString msg = Printf(FMT, __VA_ARGS__); \
+ puts(msg.c_str()); \
+ fflush(stdout); \
+ OutputDebugStringA(msg.c_str()); \
+ }
+ #else
+ #define REPORT_ERROR(FMT, ...) \
+ { \
+ AString msg = Printf(FMT, __VA_ARGS__); \
+ puts(msg.c_str()); \
+ fflush(stdout); \
+ }
+ #endif
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
- #define testassert(x) do { if(!(x)) { exit(1); } } while (0)
- #define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } exit(1); } while (0)
+ #define testassert(x) do { if(!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
+ #define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
#else
#ifdef _DEBUG