summaryrefslogtreecommitdiff
path: root/src/stdafx.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-07 12:14:45 +0000
committerrubidium <rubidium@openttd.org>2009-09-07 12:14:45 +0000
commitd9164005212e4f6f680ee845ca85aea45de7ca4a (patch)
tree9e254d613f9fb9d7c5b3b46dddf09951eb62199d /src/stdafx.h
parent46e562527887679c422c7bdc32efe4634c20670e (diff)
downloadopenttd-d9164005212e4f6f680ee845ca85aea45de7ca4a.tar.xz
(svn r17453) -Add: crash logger for all Unixy OSes; should work for all, but I don't have all exotic machines so it might break compilation on the more exotic configurations
Diffstat (limited to 'src/stdafx.h')
-rw-r--r--src/stdafx.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/stdafx.h b/src/stdafx.h
index 35cbc8b1b..f21b28ee9 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -229,12 +229,6 @@
#define strncasecmp strnicmp
#endif
-
- #if defined(NDEBUG) && defined(WITH_ASSERT)
- #undef assert
- #define assert(expression) if (!(expression)) error("Assertion failed at line %i of %s: %s", __LINE__, __FILE__, #expression);
- #endif
-
/* MSVC doesn't have these :( */
#define S_ISDIR(mode) (mode & S_IFDIR)
#define S_ISREG(mode) (mode & S_IFREG)
@@ -363,6 +357,15 @@ void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2);
void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
+/* For non-debug builds with assertions enabled use the special assertion handler:
+ * - For MSVC: NDEBUG is set for all release builds and WITH_ASSERT overrides the disabling of asserts.
+ * - For non MSVC: NDEBUG is set when assertions are disables, _DEBUG is set for non-release builds.
+ */
+#if (defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_ASSERT)) || (!defined(_MSC_VER) && !defined(NDEBUG) && !defined(_DEBUG))
+ #undef assert
+ #define assert(expression) if (!(expression)) error("Assertion failed at line %i of %s: %s", __LINE__, __FILE__, #expression);
+#endif
+
#if defined(MORPHOS) || defined(__NDS__) || defined(__DJGPP__)
/* MorphOS and NDS don't have C++ conformant _stricmp... */
#define _stricmp stricmp