aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/Errors.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-09-21 17:18:55 +0200
committerStormBytePP <stormbyte@gmail.com>2015-09-22 18:08:49 +0200
commit7af320c4194cdacc8f193b6bfd54681d86d582d0 (patch)
tree5f09d75642b3cffdfe99ad264adb3420205d0b20 /src/common/Debugging/Errors.cpp
parentb151e369686f2e3de63ba460ccaf2173c9a6a104 (diff)
Partially revert "Core/Build: Added missing abort() calls on error handlers"
This reverts commit 8ea17647e6bced9d4d027c94ecdc63369cb4c6df.
Diffstat (limited to 'src/common/Debugging/Errors.cpp')
-rw-r--r--src/common/Debugging/Errors.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp
index f2da96b86bf..45f130ceb3b 100644
--- a/src/common/Debugging/Errors.cpp
+++ b/src/common/Debugging/Errors.cpp
@@ -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