Core/Debugging: Extended ASSERT macro to allow passing additional formatted string

This commit is contained in:
Shauren
2014-09-26 20:47:48 +02:00
parent 7b72342658
commit 71644043d2
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -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",