Skip to content

Commit 5f21755

Browse files
refackjasnell
authored andcommitted
src: replace NO_RETURN with [[noreturn]]
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>
1 parent 2303e4c commit 5f21755

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/node.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1038,14 +1038,14 @@ static MaybeLocal<Value> ExecuteString(Environment* env,
10381038
}
10391039

10401040

1041-
NO_RETURN void Abort() {
1041+
[[noreturn]] void Abort() {
10421042
DumpBacktrace(stderr);
10431043
fflush(stderr);
10441044
ABORT_NO_BACKTRACE();
10451045
}
10461046

10471047

1048-
NO_RETURN void Assert(const char* const (*args)[4]) {
1048+
[[noreturn]] void Assert(const char* const (*args)[4]) {
10491049
auto filename = (*args)[0];
10501050
auto linenum = (*args)[1];
10511051
auto message = (*args)[2];
@@ -1354,7 +1354,7 @@ static void OnFatalError(const char* location, const char* message) {
13541354
}
13551355

13561356

1357-
NO_RETURN void FatalError(const char* location, const char* message) {
1357+
[[noreturn]] void FatalError(const char* location, const char* message) {
13581358
OnFatalError(location, message);
13591359
// to suppress compiler warning
13601360
ABORT();

src/node_internals.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void AppendExceptionLine(Environment* env,
253253
v8::Local<v8::Message> message,
254254
enum ErrorHandlingMode mode);
255255

256-
NO_RETURN void FatalError(const char* location, const char* message);
256+
[[noreturn]] void FatalError(const char* location, const char* message);
257257

258258
// Like a `TryCatch` but exits the process if an exception was caught.
259259
class FatalTryCatch : public v8::TryCatch {

src/util.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,10 @@ inline T MultiplyWithOverflowCheck(T a, T b);
7777
// whether V8 is initialized.
7878
void LowMemoryNotification();
7979

80-
#ifdef __GNUC__
81-
#define NO_RETURN __attribute__((noreturn))
82-
#else
83-
#define NO_RETURN
84-
#endif
85-
8680
// The slightly odd function signature for Assert() is to ease
8781
// instruction cache pressure in calls from CHECK.
88-
NO_RETURN void Abort();
89-
NO_RETURN void Assert(const char* const (*args)[4]);
82+
[[noreturn]] void Abort();
83+
[[noreturn]] void Assert(const char* const (*args)[4]);
9084
void DumpBacktrace(FILE* fp);
9185

9286
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \

0 commit comments

Comments
 (0)