Skip to content

Commit

Permalink
src: replace NO_RETURN with [[noreturn]]
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
refack authored and MylesBorins committed Oct 30, 2018
1 parent 39c59be commit 168885f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1039,14 +1039,14 @@ static MaybeLocal<Value> 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];
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void AppendExceptionLine(Environment* env,
v8::Local<v8::Message> 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 {
Expand Down
10 changes: 2 additions & 8 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit 168885f

Please sign in to comment.