diff --git a/src/node.cc b/src/node.cc index e52b2811aced95..28ed9f2db9f927 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1039,14 +1039,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 cbc8fe20295927..12089bc5f4af62 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) \