30 #define _WIN32_WINNT 0x0501
36 #define NORETURN __declspec(noreturn)
37 #define FUNCTION_NAME __FUNCTION__
39 #define NORETURN __attribute__ ((__noreturn__))
40 #define FUNCTION_NAME __PRETTY_FUNCTION__
47 #define CATCH_UNHANDLED_EXCEPTIONS 1
49 #define CATCH_UNHANDLED_EXCEPTIONS 0
55 const char *msg,
const char *file,
56 unsigned int line,
const char *
function);
58 #define FATAL_ERROR(msg) \
59 fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME)
61 #define FATAL_ERROR_IF(expr, msg) \
63 ? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \
73 const char *assertion,
const char *file,
74 unsigned int line,
const char *
function);
76 #define SANITY_CHECK(expr) \
79 : sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME))
81 #define sanity_check(expr) SANITY_CHECK(expr)
90 #if CATCH_UNHANDLED_EXCEPTIONS == 1
91 #define BEGIN_DEBUG_EXCEPTION_HANDLER try {
92 #define END_DEBUG_EXCEPTION_HANDLER \
93 } catch (std::exception &e) { \
94 errorstream << "An unhandled exception occurred: " \
95 << e.what() << std::endl; \
96 FATAL_ERROR(e.what()); \
100 #define BEGIN_DEBUG_EXCEPTION_HANDLER
101 #define END_DEBUG_EXCEPTION_HANDLER
NORETURN void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function)
Definition: debug.cpp:47
void debug_set_exception_handler()
Definition: debug.cpp:191
#define NORETURN
Definition: debug.h:39
NORETURN void fatal_error_fn(const char *msg, const char *file, unsigned int line, const char *function)
Definition: debug.cpp:62