mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
src: mark fatal error functions as noreturn
OnFatalError and OOMErrorHandler will not return control flow to the calling function. node::FatalError is an alias of node::OnFatalError. Replace all the callsites with node::OnFatalError instead. PR-URL: https://github.com/nodejs/node/pull/47695 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
1 parent
f34a07d3a7
commit
6700aac615
7 files changed
+14
-20
No files matched your search
+3
-8
@@ -504,13 +504,7 @@ static void ReportFatalException(Environment* env,
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
[[noreturn]] void FatalError(const char* location, const char* message) {
|
||||
OnFatalError(location, message);
|
||||
// to suppress compiler warning
|
||||
ABORT();
|
||||
}
|
||||
|
||||
void OnFatalError(const char* location, const char* message) {
|
||||
[[noreturn]] void OnFatalError(const char* location, const char* message) {
|
||||
if (location) {
|
||||
FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message);
|
||||
} else {
|
||||
@@ -532,7 +526,8 @@ void OnFatalError(const char* location, const char* message) {
|
||||
ABORT();
|
||||
}
|
||||
|
||||
void OOMErrorHandler(const char* location, const v8::OOMDetails& details) {
|
||||
[[noreturn]] void OOMErrorHandler(const char* location,
|
||||
const v8::OOMDetails& details) {
|
||||
const char* message =
|
||||
details.is_heap_oom ? "Allocation failed - JavaScript heap out of memory"
|
||||
: "Allocation failed - process out of memory";
|
||||
|
||||
Reference in new issue
Block a user