diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:19:54 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:19:54 +0100 |
commit | ad148587dcf5244c2d2011dba339786c765c54c4 (patch) | |
tree | bdd914121cd326da2ed26679838878e3edffc841 /src/debug.h | |
parent | 1145b05ea0bda87dc0827821385810eced08f774 (diff) | |
download | dragonfireclient-ad148587dcf5244c2d2011dba339786c765c54c4.tar.xz |
Make Lint Happy
Diffstat (limited to 'src/debug.h')
-rw-r--r-- | src/debug.h | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/src/debug.h b/src/debug.h index 1faeece8d..75acf493f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -26,42 +26,38 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #ifdef _WIN32 - #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0501 - #endif - #include <windows.h> - #ifdef _MSC_VER - #include <eh.h> - #endif - #define NORETURN __declspec(noreturn) - #define FUNCTION_NAME __FUNCTION__ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif +#include <windows.h> +#ifdef _MSC_VER +#include <eh.h> +#endif +#define NORETURN __declspec(noreturn) +#define FUNCTION_NAME __FUNCTION__ #else - #define NORETURN __attribute__ ((__noreturn__)) - #define FUNCTION_NAME __PRETTY_FUNCTION__ +#define NORETURN __attribute__((__noreturn__)) +#define FUNCTION_NAME __PRETTY_FUNCTION__ #endif // Whether to catch all std::exceptions. // When "catching", the program will abort with an error message. // In debug mode, leave these for the debugger and don't catch them. #ifdef NDEBUG - #define CATCH_UNHANDLED_EXCEPTIONS 1 +#define CATCH_UNHANDLED_EXCEPTIONS 1 #else - #define CATCH_UNHANDLED_EXCEPTIONS 0 +#define CATCH_UNHANDLED_EXCEPTIONS 0 #endif /* Abort program execution immediately */ -NORETURN extern void fatal_error_fn( - const char *msg, const char *file, - unsigned int line, const char *function); +NORETURN extern void fatal_error_fn(const char *msg, const char *file, unsigned int line, + const char *function); -#define FATAL_ERROR(msg) \ - fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) +#define FATAL_ERROR(msg) fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) -#define FATAL_ERROR_IF(expr, msg) \ - ((expr) \ - ? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \ - : (void)(0)) +#define FATAL_ERROR_IF(expr, msg) \ + ((expr) ? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) : (void)(0)) /* sanity_check() @@ -69,18 +65,14 @@ NORETURN extern void fatal_error_fn( defined) */ -NORETURN extern void sanity_check_fn( - const char *assertion, const char *file, +NORETURN extern void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function); -#define SANITY_CHECK(expr) \ - ((expr) \ - ? (void)(0) \ - : sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME)) +#define SANITY_CHECK(expr) \ + ((expr) ? (void)(0) : sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME)) #define sanity_check(expr) SANITY_CHECK(expr) - void debug_set_exception_handler(); /* @@ -88,15 +80,17 @@ void debug_set_exception_handler(); */ #if CATCH_UNHANDLED_EXCEPTIONS == 1 - #define BEGIN_DEBUG_EXCEPTION_HANDLER try { - #define END_DEBUG_EXCEPTION_HANDLER \ - } catch (std::exception &e) { \ - errorstream << "An unhandled exception occurred: " \ - << e.what() << std::endl; \ - FATAL_ERROR(e.what()); \ - } +#define BEGIN_DEBUG_EXCEPTION_HANDLER try { +#define END_DEBUG_EXCEPTION_HANDLER \ + } \ + catch (std::exception & e) \ + { \ + errorstream << "An unhandled exception occurred: " << e.what() \ + << std::endl; \ + FATAL_ERROR(e.what()); \ + } #else - // Dummy ones - #define BEGIN_DEBUG_EXCEPTION_HANDLER - #define END_DEBUG_EXCEPTION_HANDLER +// Dummy ones +#define BEGIN_DEBUG_EXCEPTION_HANDLER +#define END_DEBUG_EXCEPTION_HANDLER #endif |