From 5cf28be742581d335ecb0c270e8039ee8ed9ccf0 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 5 Sep 2016 01:18:09 +0100 Subject: Codechange: Add support for verbose asserts --- src/openttd.cpp | 2 +- src/stdafx.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/openttd.cpp b/src/openttd.cpp index e4fcf40e9..33f65314d 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -129,7 +129,7 @@ void CDECL usererror(const char *s, ...) void CDECL error(const char *s, ...) { va_list va; - char buf[512]; + char buf[2048]; va_start(va, s); vseprintf(buf, lastof(buf), s, va); diff --git a/src/stdafx.h b/src/stdafx.h index 9b9f4c6a9..00dd1322a 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -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. */ #if !defined(NDEBUG) || defined(WITH_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 #if defined(OPENBSD) -- cgit v1.2.3-54-g00ecf