mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add support for verbose asserts
parent
eb74179c6d
commit
5cf28be742
|
@ -129,7 +129,7 @@ void CDECL usererror(const char *s, ...)
|
||||||
void CDECL error(const char *s, ...)
|
void CDECL error(const char *s, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
char buf[512];
|
char buf[2048];
|
||||||
|
|
||||||
va_start(va, s);
|
va_start(va, s);
|
||||||
vseprintf(buf, lastof(buf), s, va);
|
vseprintf(buf, lastof(buf), s, va);
|
||||||
|
|
|
@ -430,6 +430,9 @@ void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);
|
||||||
/* Asserts are enabled if NDEBUG isn't defined or WITH_ASSERT is defined. */
|
/* Asserts are enabled if NDEBUG isn't defined or WITH_ASSERT is defined. */
|
||||||
#if !defined(NDEBUG) || defined(WITH_ASSERT)
|
#if !defined(NDEBUG) || defined(WITH_ASSERT)
|
||||||
# define OTTD_ASSERT
|
# define OTTD_ASSERT
|
||||||
|
# define assert_msg(expression, msg, ...) if (!(expression)) error("Assertion failed at line %i of %s: %s\n\t" msg, __LINE__, __FILE__, #expression, __VA_ARGS__);
|
||||||
|
#else
|
||||||
|
# define assert_msg(expression, msg, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OPENBSD)
|
#if defined(OPENBSD)
|
||||||
|
|
Loading…
Reference in New Issue