refactor: remove `stdnoreturn.h` includes
The `noreturn` macro and `_Noreturn` keywords are deprecated in C23. The
reccommended way to indicate noreturn is now `[[noreturn]]`, which uses
the new C23 attribute syntax.
Change-Id: Ib923fce8bbe97597aa5ed27bb0962a107191022b
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/abort.c b/src/abort.c
index 2d30b3c..c62eaa0 100644
--- a/src/abort.c
+++ b/src/abort.c
@@ -16,7 +16,7 @@
*
* TODO: Should this also reset the system?
*/
-noreturn void abort(void)
+[[noreturn]] void abort(void)
{
/* TODO: Block all CPUs. */
for (;;) {
diff --git a/src/arch/aarch64/hftest/interrupts.c b/src/arch/aarch64/hftest/interrupts.c
index eaa7822..3f96cb1 100644
--- a/src/arch/aarch64/hftest/interrupts.c
+++ b/src/arch/aarch64/hftest/interrupts.c
@@ -37,7 +37,7 @@
return false;
}
-noreturn static bool default_sync_current_exception(void)
+[[noreturn]] static bool default_sync_current_exception(void)
{
uintreg_t esr = read_msr(esr_el1);
uintreg_t elr = read_msr(elr_el1);
diff --git a/src/arch/aarch64/hftest/power_mgmt.c b/src/arch/aarch64/hftest/power_mgmt.c
index b8d9876..68a2c33 100644
--- a/src/arch/aarch64/hftest/power_mgmt.c
+++ b/src/arch/aarch64/hftest/power_mgmt.c
@@ -38,7 +38,7 @@
/**
* Stops the current CPU.
*/
-noreturn void arch_cpu_stop(void)
+[[noreturn]] void arch_cpu_stop(void)
{
smc32(PSCI_CPU_OFF, 0, 0, 0, 0, 0, 0, SMCCC_CALLER_HYPERVISOR);
for (;;) {
@@ -75,7 +75,7 @@
/**
* Shuts down the system or exits emulation.
*/
-noreturn void arch_power_off(void)
+[[noreturn]] void arch_power_off(void)
{
smc32(PSCI_SYSTEM_OFF, 0, 0, 0, 0, 0, 0, SMCCC_CALLER_HYPERVISOR);
for (;;) {
@@ -86,7 +86,7 @@
/**
* Restarts the system.
*/
-noreturn void arch_reboot(void)
+[[noreturn]] void arch_reboot(void)
{
smc32(PSCI_SYSTEM_RESET, 0, 0, 0, 0, 0, 0, SMCCC_CALLER_HYPERVISOR);
for (;;) {
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 7e55fc9..4f544c0 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -6,8 +6,6 @@
* https://opensource.org/licenses/BSD-3-Clause.
*/
-#include <stdnoreturn.h>
-
#include "hf/arch/barriers.h"
#include "hf/arch/gicv3.h"
#include "hf/arch/host_timer.h"
@@ -165,7 +163,7 @@
}
}
-noreturn void irq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
+[[noreturn]] void irq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
{
(void)elr;
(void)spsr;
@@ -173,7 +171,7 @@
panic("IRQ from current exception level.");
}
-noreturn void fiq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
+[[noreturn]] void fiq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
{
(void)elr;
(void)spsr;
@@ -181,7 +179,7 @@
panic("FIQ from current exception level.");
}
-noreturn void serr_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
+[[noreturn]] void serr_current_exception_noreturn(uintreg_t elr, uintreg_t spsr)
{
(void)elr;
(void)spsr;
@@ -1047,7 +1045,7 @@
#endif
}
-noreturn struct vcpu *serr_lower(void)
+[[noreturn]] struct vcpu *serr_lower(void)
{
/*
* SError exceptions should be isolated and handled by the responsible
diff --git a/src/arch/aarch64/inc/hf/arch/vm/power_mgmt.h b/src/arch/aarch64/inc/hf/arch/vm/power_mgmt.h
index bc4d805..7bf8d4b 100644
--- a/src/arch/aarch64/inc/hf/arch/vm/power_mgmt.h
+++ b/src/arch/aarch64/inc/hf/arch/vm/power_mgmt.h
@@ -10,7 +10,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <stdnoreturn.h>
#include "hf/arch/types.h"
@@ -40,8 +39,8 @@
bool arch_cpu_start(uintptr_t id, struct arch_cpu_start_state *s);
-noreturn void arch_cpu_stop(void);
+[[noreturn]] void arch_cpu_stop(void);
enum power_status arch_cpu_status(cpu_id_t cpu_id);
-noreturn void arch_power_off(void);
-noreturn void arch_reboot(void);
+[[noreturn]] void arch_power_off(void);
+[[noreturn]] void arch_reboot(void);
diff --git a/src/arch/aarch64/qemuloader/loader.c b/src/arch/aarch64/qemuloader/loader.c
index c5a06c0..8a3badf 100644
--- a/src/arch/aarch64/qemuloader/loader.c
+++ b/src/arch/aarch64/qemuloader/loader.c
@@ -7,7 +7,6 @@
*/
#include <stdint.h>
-#include <stdnoreturn.h>
#include "hf/arch/std.h"
@@ -25,8 +24,8 @@
typedef void entry_point(struct fdt_header *, uint64_t, uint64_t, uint64_t);
-static noreturn void jump_to_kernel(struct fdt_header *fdt,
- entry_point *kernel_entry)
+[[noreturn]] static void jump_to_kernel(struct fdt_header *fdt,
+ entry_point *kernel_entry)
{
kernel_entry(fdt, 0, 0, 0);
@@ -83,7 +82,7 @@
return true;
}
-noreturn void kmain(struct fdt_header *fdt)
+[[noreturn]] void kmain(struct fdt_header *fdt)
{
uintptr_t kernel_start;
uint32_t kernel_size;
diff --git a/src/arch/aarch64/stack_protector.c b/src/arch/aarch64/stack_protector.c
index f0659c3..ce0c218 100644
--- a/src/arch/aarch64/stack_protector.c
+++ b/src/arch/aarch64/stack_protector.c
@@ -7,7 +7,6 @@
*/
#include <stdint.h>
-#include <stdnoreturn.h>
#include "hf/panic.h"
@@ -28,7 +27,7 @@
* Called when the stack canary is invalid. The stack can no longer be trusted
* so this function must not return.
*/
-noreturn void __stack_chk_fail(void)
+[[noreturn]] void __stack_chk_fail(void)
{
panic("stack corruption");
}
diff --git a/src/arch/fake/hftest/power_mgmt.c b/src/arch/fake/hftest/power_mgmt.c
index 917b31f..06555a2 100644
--- a/src/arch/fake/hftest/power_mgmt.c
+++ b/src/arch/fake/hftest/power_mgmt.c
@@ -10,7 +10,7 @@
#include <sys/reboot.h>
-noreturn void arch_power_off(void)
+[[noreturn]] void arch_power_off(void)
{
reboot(RB_POWER_OFF);
for (;;) {
diff --git a/src/arch/fake/inc/hf/arch/vm/power_mgmt.h b/src/arch/fake/inc/hf/arch/vm/power_mgmt.h
index 356798d..381a27c 100644
--- a/src/arch/fake/inc/hf/arch/vm/power_mgmt.h
+++ b/src/arch/fake/inc/hf/arch/vm/power_mgmt.h
@@ -8,6 +8,4 @@
#pragma once
-#include <stdnoreturn.h>
-
-noreturn void arch_power_off(void);
+[[noreturn]] void arch_power_off(void);
diff --git a/src/panic.c b/src/panic.c
index cfd9a37..a810916 100644
--- a/src/panic.c
+++ b/src/panic.c
@@ -18,7 +18,7 @@
*
* TODO: Determine if we want to omit strings on non-debug builds.
*/
-noreturn void panic(const char *fmt, ...)
+[[noreturn]] void panic(const char *fmt, ...)
{
struct va_list_wrapper args;