From 8598b1e8fcaa8e863a693341499cf52082baa816 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 6 Dec 2022 19:40:35 +0100 Subject: [PATCH] Replace the _noreturn macro with the C++ native attribute [[noreturn]] --- kernel/src/Log.cpp | 2 +- luna/include/luna/Attributes.h | 3 +-- luna/include/luna/Check.h | 2 +- luna/src/Check.cpp | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/src/Log.cpp b/kernel/src/Log.cpp index e4079699..5d242ac6 100644 --- a/kernel/src/Log.cpp +++ b/kernel/src/Log.cpp @@ -118,7 +118,7 @@ bool log_text_console_enabled() static bool g_check_already_failed = false; -_noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr) +[[noreturn]] bool __check_failed(const char* file, const char* line, const char* func, const char* expr) { if (!g_check_already_failed) { // Avoid endlessly failing when trying to report a failed check. diff --git a/luna/include/luna/Attributes.h b/luna/include/luna/Attributes.h index f137161d..2f8edf7e 100644 --- a/luna/include/luna/Attributes.h +++ b/luna/include/luna/Attributes.h @@ -2,5 +2,4 @@ #define _weak __attribute__((weak)) #define _format(n, m) __attribute__((format(printf, n, m))) -#define _align(x) __attribute__((aligned(x))) -#define _noreturn __attribute__((noreturn)) \ No newline at end of file +#define _align(x) __attribute__((aligned(x))) \ No newline at end of file diff --git a/luna/include/luna/Check.h b/luna/include/luna/Check.h index fe1c7f50..37c3b13f 100644 --- a/luna/include/luna/Check.h +++ b/luna/include/luna/Check.h @@ -1,7 +1,7 @@ #pragma once #include -extern _noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr); +[[noreturn]] extern bool __check_failed(const char* file, const char* line, const char* func, const char* expr); #ifndef STRINGIZE_VALUE_OF #define STRINGIZE(x) #x diff --git a/luna/src/Check.cpp b/luna/src/Check.cpp index 4f522f79..f01fef8d 100644 --- a/luna/src/Check.cpp +++ b/luna/src/Check.cpp @@ -1,6 +1,6 @@ #include -_weak _noreturn bool __check_failed(const char*, const char*, const char*, const char*) +_weak [[noreturn]] bool __check_failed(const char*, const char*, const char*, const char*) { __builtin_trap(); } \ No newline at end of file