Core/Debugging: Extended ASSERT macro to allow passing additional formatted string
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <thread>
|
||||
#include <cstdarg>
|
||||
|
||||
namespace Trinity {
|
||||
|
||||
@@ -32,6 +33,21 @@ void Assert(char const* file, int line, char const* function, char const* messag
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s ", file, line, function, message);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
|
||||
va_end(args);
|
||||
*((volatile int*)NULL) = 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void Fatal(char const* file, int line, char const* function, char const* message)
|
||||
{
|
||||
fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n",
|
||||
|
||||
Reference in New Issue
Block a user