src: replace NO_RETURN with [[noreturn]]

PR-URL: https://github.com/nodejs/node/pull/23337
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Refael Ackermann 2018-10-08 10:41:47 -04:00
parent d4ce144b0a
commit 03e1865baf
3 changed files with 6 additions and 12 deletions

View File

@ -1038,14 +1038,14 @@ static MaybeLocal<Value> ExecuteString(Environment* env,
} }
NO_RETURN void Abort() { [[noreturn]] void Abort() {
DumpBacktrace(stderr); DumpBacktrace(stderr);
fflush(stderr); fflush(stderr);
ABORT_NO_BACKTRACE(); 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 filename = (*args)[0];
auto linenum = (*args)[1]; auto linenum = (*args)[1];
auto message = (*args)[2]; 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); OnFatalError(location, message);
// to suppress compiler warning // to suppress compiler warning
ABORT(); ABORT();

View File

@ -253,7 +253,7 @@ void AppendExceptionLine(Environment* env,
v8::Local<v8::Message> message, v8::Local<v8::Message> message,
enum ErrorHandlingMode mode); 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. // Like a `TryCatch` but exits the process if an exception was caught.
class FatalTryCatch : public v8::TryCatch { class FatalTryCatch : public v8::TryCatch {

View File

@ -77,16 +77,10 @@ inline T MultiplyWithOverflowCheck(T a, T b);
// whether V8 is initialized. // whether V8 is initialized.
void LowMemoryNotification(); void LowMemoryNotification();
#ifdef __GNUC__
#define NO_RETURN __attribute__((noreturn))
#else
#define NO_RETURN
#endif
// The slightly odd function signature for Assert() is to ease // The slightly odd function signature for Assert() is to ease
// instruction cache pressure in calls from CHECK. // instruction cache pressure in calls from CHECK.
NO_RETURN void Abort(); [[noreturn]] void Abort();
NO_RETURN void Assert(const char* const (*args)[4]); [[noreturn]] void Assert(const char* const (*args)[4]);
void DumpBacktrace(FILE* fp); void DumpBacktrace(FILE* fp);
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ #define DISALLOW_COPY_AND_ASSIGN(TypeName) \