1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives

This commit is contained in:
Craig Robbins 2015-03-06 20:21:51 +10:00
parent a603a76787
commit ced6d20295
62 changed files with 299 additions and 294 deletions

View file

@ -133,11 +133,11 @@ Nullstream dummyout;
Assert
*/
void assert_fail(const char *assertion, const char *file,
void sanity_check_fn(const char *assertion, const char *file,
unsigned int line, const char *function)
{
DEBUGPRINT("\nIn thread %lx:\n"
"%s:%u: %s: Assertion '%s' failed.\n",
"%s:%u: %s: An engine assumption '%s' failed.\n",
(unsigned long)get_current_thread_id(),
file, line, function, assertion);
@ -149,6 +149,22 @@ void assert_fail(const char *assertion, const char *file,
abort();
}
void fatal_error_fn(const char *msg, const char *file,
unsigned int line, const char *function)
{
DEBUGPRINT("\nIn thread %lx:\n"
"%s:%u: %s: A fatal error occurred: %s\n",
(unsigned long)get_current_thread_id(),
file, line, function, msg);
debug_stacks_print();
if(g_debugstreams[1])
fclose(g_debugstreams[1]);
abort();
}
/*
DebugStack
*/