Skip to content

Commit 168885f

Browse files
refackMylesBorins
authored andcommitted
src: replace NO_RETURN with [[noreturn]]
PR-URL: #23337 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 39c59be commit 168885f

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/node.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,14 +1039,14 @@ static MaybeLocal<Value> ExecuteString(Environment* env,
10391039
}
10401040

10411041

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

10481048

1049-
NO_RETURN void Assert(const char* const (*args)[4]) {
1049+
[[noreturn]] void Assert(const char* const (*args)[4]) {
10501050
auto filename = (*args)[0];
10511051
auto linenum = (*args)[1];
10521052
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 8 deletions
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)