Mercurial > hg > openttd
changeset 12918:d595a7dce1de draft
(svn r17410) -Codechange: use the same define for determining whether windows does crash reports instead of using several that aren't necessarily equal
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 03 Sep 2009 22:32:08 +0000 |
parents | d223546bf49d |
children | a93d65b7da9f |
files | src/os/windows/crashlog_win.cpp src/os/windows/win32.cpp src/stdafx.h |
diffstat | 3 files changed, 23 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -9,11 +9,21 @@ /** @file crashlog_win.cpp Implementation of a crashlogger for Windows */ +#if defined(WIN32_EXCEPTION_TRACKER) + #include "../../stdafx.h" -#include <windows.h> #include "win32.h" +#include "../../core/alloc_func.hpp" +#include "../../string_func.h" +#include "../../gamelog.h" +#include "../../saveload/saveload.h" +#include "../../fileio_func.h" +#include "../../rev.h" +#include "../../strings_func.h" -#ifdef _MSC_VER +#include <windows.h> +#include <dbghelp.h> + static const char *_exception_string = NULL; void SetExceptionString(const char *s, ...) { @@ -26,18 +36,6 @@ _exception_string = strdup(buf); } -#endif - -#if defined(_MSC_VER) && !defined(WINCE) - -#include "../../core/alloc_func.hpp" -#include "../../string_func.h" -#include "../../gamelog.h" -#include "../../saveload/saveload.h" -#include "../../fileio_func.h" -#include "../../rev.h" -#include <dbghelp.h> -#include "../../strings_func.h" static void *_safe_esp; static char *_crash_msg; @@ -497,4 +495,4 @@ SetUnhandledExceptionFilter(ExceptionHandler); } -#endif /* _MSC_VER */ +#endif /* WIN32_EXCEPTION_TRACKER */
--- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -73,8 +73,8 @@ MyShowCursor(true); MessageBox(GetActiveWindow(), MB_TO_WIDE(buf), _T("Error!"), MB_ICONSTOP); -/* if exception tracker is enabled, we crash here to let the exception handler handle it. */ -#if defined(WIN32_EXCEPTION_TRACKER) && !defined(_DEBUG) + /* If exception tracker is enabled, we crash here to let the exception handler handle it. */ +#if defined(WIN32_EXCEPTION_TRACKER) && defined(NDEBUG) if (system) { SetExceptionString("%s", buf); *(byte*)0 = 0; @@ -383,20 +383,11 @@ argc = ParseCommandLine(cmdline, argv, lengthof(argv)); #if defined(WIN32_EXCEPTION_TRACKER) - extern void Win32InitializeExceptions(); + void Win32InitializeExceptions(); Win32InitializeExceptions(); #endif -#if defined(WIN32_EXCEPTION_TRACKER_DEBUG) - _try { - LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep); -#endif - ttd_main(argc, argv); - -#if defined(WIN32_EXCEPTION_TRACKER_DEBUG) - } _except (ExceptionHandler(_exception_info())) {} -#endif - + ttd_main(argc, argv); return 0; }
--- a/src/stdafx.h +++ b/src/stdafx.h @@ -229,11 +229,13 @@ #define strncasecmp strnicmp #endif - void SetExceptionString(const char *s, ...) WARN_FORMAT(1, 2); - #if defined(NDEBUG) && defined(WITH_ASSERT) - #undef assert - #define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; } + #if defined(WIN32_EXCEPTION_TRACKER) + void SetExceptionString(const char *s, ...) WARN_FORMAT(1, 2); + #if defined(NDEBUG) && defined(WITH_ASSERT) + #undef assert + #define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; } + #endif #endif /* MSVC doesn't have these :( */