mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Partially revert "Core/Build: Added missing abort() calls on error handlers"
This reverts commit 8ea17647e6.
This commit is contained in:
@@ -23,13 +23,25 @@
|
||||
#include <thread>
|
||||
#include <cstdarg>
|
||||
|
||||
/**
|
||||
@file Errors.cpp
|
||||
|
||||
@brief This file contains definitions of functions used for reporting critical application errors
|
||||
|
||||
It is very important that (std::)abort is NEVER called in place of *((volatile int*)NULL) = 0;
|
||||
Calling abort() on Windows does not invoke unhandled exception filters - a mechanism used by WheatyExceptionReport
|
||||
to log crashes. exit(1) calls here are for static analysis tools to indicate that calling functions defined in this file
|
||||
terminates the application.
|
||||
*/
|
||||
|
||||
namespace Trinity {
|
||||
|
||||
void Assert(char const* file, int line, char const* function, char const* message)
|
||||
{
|
||||
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n",
|
||||
file, line, function, message);
|
||||
abort();
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...)
|
||||
@@ -43,7 +55,8 @@ void Assert(char const* file, int line, char const* function, char const* messag
|
||||
fflush(stderr);
|
||||
|
||||
va_end(args);
|
||||
abort();
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Fatal(char const* file, int line, char const* function, char const* message)
|
||||
@@ -52,14 +65,16 @@ void Fatal(char const* file, int line, char const* function, char const* message
|
||||
file, line, function, message);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
abort();
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Error(char const* file, int line, char const* function, char const* message)
|
||||
{
|
||||
fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n",
|
||||
file, line, function, message);
|
||||
abort();
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Warning(char const* file, int line, char const* function, char const* message)
|
||||
@@ -72,7 +87,8 @@ void Abort(char const* file, int line, char const* function)
|
||||
{
|
||||
fprintf(stderr, "\n%s:%i in %s ABORTED.\n",
|
||||
file, line, function);
|
||||
abort();
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
} // namespace Trinity
|
||||
|
||||
Reference in New Issue
Block a user