From 472f20786678f3a69aee17961d8fcd8818266216 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Mon, 8 Oct 2018 10:41:47 -0400 Subject: [PATCH] src: replace NO_RETURN with [[noreturn]] --- src/node.cc | 6 +++--- src/node_internals.h | 2 +- src/util.h | 10 ++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/node.cc b/src/node.cc index 6250acfd5d540f..e85fab676083cd 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1038,14 +1038,14 @@ static MaybeLocal ExecuteString(Environment* env, } -NO_RETURN void Abort() { +[[noreturn]] void Abort() { DumpBacktrace(stderr); fflush(stderr); ABORT_NO_BACKTRACE(); } -NO_RETURN void Assert(const char* const (*args)[4]) { +[[noreturn]] void Assert(const char* const (*args)[4]) { auto filename = (*args)[0]; auto linenum = (*args)[1]; auto message = (*args)[2]; @@ -1354,7 +1354,7 @@ static void OnFatalError(const char* location, const char* message) { } -NO_RETURN void FatalError(const char* location, const char* message) { +[[noreturn]] void FatalError(const char* location, const char* message) { OnFatalError(location, message); // to suppress compiler warning ABORT(); diff --git a/src/node_internals.h b/src/node_internals.h index 0c0b2e317620ce..d934d0f1095c1a 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -253,7 +253,7 @@ void AppendExceptionLine(Environment* env, v8::Local message, enum ErrorHandlingMode mode); -NO_RETURN void FatalError(const char* location, const char* message); +[[noreturn]] void FatalError(const char* location, const char* message); // Like a `TryCatch` but exits the process if an exception was caught. class FatalTryCatch : public v8::TryCatch { diff --git a/src/util.h b/src/util.h index 91d61f121ba48c..b522a88b7265c5 100644 --- a/src/util.h +++ b/src/util.h @@ -77,16 +77,10 @@ inline T MultiplyWithOverflowCheck(T a, T b); // whether V8 is initialized. void LowMemoryNotification(); -#ifdef __GNUC__ -#define NO_RETURN __attribute__((noreturn)) -#else -#define NO_RETURN -#endif - // The slightly odd function signature for Assert() is to ease // instruction cache pressure in calls from CHECK. -NO_RETURN void Abort(); -NO_RETURN void Assert(const char* const (*args)[4]); +[[noreturn]] void Abort(); +[[noreturn]] void Assert(const char* const (*args)[4]); void DumpBacktrace(FILE* fp); #define DISALLOW_COPY_AND_ASSIGN(TypeName) \