diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-09-21 17:18:55 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-09-21 17:18:55 +0200 |
commit | e6e5f5c559694d179a6e6db76832c5454448437c (patch) | |
tree | 09b9164fdf86d57e45da970e7b7680f218b1b092 /src/common/Debugging/Errors.cpp | |
parent | 8ea17647e6bced9d4d027c94ecdc63369cb4c6df (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.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 951dd3d8e8c..6c295a993f5 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 |