Revised ASSERT()

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@536 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2006-08-05 18:05:11 +00:00
parent 40da012608
commit bdd91a32d2
1 changed files with 24 additions and 15 deletions

View File

@ -47,21 +47,30 @@
*
* Arguments: ASSERT((condition, "Format string with variables: %d, %d", var1, var2));
*/
#ifdef _MSC_VER
// MSVC doesn't understand __VAR_ARGS__ macros
# define ASSERT(x)
#ifdef DEBUG
#ifndef _MSC_VER
#undef ASSERT
#else
# define ASSERT(x) wz_assert x
# ifdef DEBUG
# define wz_assert(x, ...) \
do { \
if (!(x)) { \
debug(LOG_ERROR, "Fatal error in Warzone file %s, function %s, line %d", \
debug(LOG_ERROR, "Error in Warzone: file %s, function %s, line %d", \
__FILE__, __FUNCTION__, __LINE__); \
debug(LOG_ERROR, __VA_ARGS__); \
assert(x); \
} \
} while (FALSE)
# else
# define wz_assert(x, ...) \
do { \
if (!(x)) { \
debug(LOG_ERROR, "Error in Warzone: file %s, function %s, line %d", \
__FILE__, __FUNCTION__, __LINE__); \
debug(LOG_ERROR, __VA_ARGS__); \
} \
} while (FALSE)
# endif
#endif