aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/Errors.cpp
diff options
context:
space:
mode:
authorStormBytePP <stormbyte@gmail.com>2015-09-21 15:09:41 +0200
committerStormBytePP <stormbyte@gmail.com>2015-09-21 15:11:06 +0200
commit7b245a0b6b9902ebea98d2a945d4ee0e26a62681 (patch)
treea30ef097011505ac095c267fc2f667fadac409bd /src/common/Debugging/Errors.cpp
parentff71da2b05210c1d0ed088ef12b06bf4632ff830 (diff)
Core: Added ABORT() macro to prevent the usage of ASSERT(false) as a quick hack to crash the core misusing assert
Diffstat (limited to 'src/common/Debugging/Errors.cpp')
-rw-r--r--src/common/Debugging/Errors.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp
index cebd9d4cf2f..f2da96b86bf 100644
--- a/src/common/Debugging/Errors.cpp
+++ b/src/common/Debugging/Errors.cpp
@@ -29,8 +29,7 @@ void Assert(char const* file, int line, char const* function, char const* messag
{
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n",
file, line, function, message);
- *((volatile int*)NULL) = 0;
- exit(1);
+ abort();
}
void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...)
@@ -44,8 +43,7 @@ void Assert(char const* file, int line, char const* function, char const* messag
fflush(stderr);
va_end(args);
- *((volatile int*)NULL) = 0;
- exit(1);
+ abort();
}
void Fatal(char const* file, int line, char const* function, char const* message)
@@ -54,16 +52,14 @@ 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));
- *((volatile int*)NULL) = 0;
- exit(1);
+ abort();
}
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);
- *((volatile int*)NULL) = 0;
- exit(1);
+ abort();
}
void Warning(char const* file, int line, char const* function, char const* message)
@@ -72,4 +68,11 @@ void Warning(char const* file, int line, char const* function, char const* messa
file, line, function, message);
}
+void Abort(char const* file, int line, char const* function)
+{
+ fprintf(stderr, "\n%s:%i in %s ABORTED\n",
+ file, line, function);
+ abort();
+}
+
} // namespace Trinity