summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2020-07-28 11:54:18 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-17 20:14:48 +0000
commit84c97f043260e0b06b585ae2a46cc4e9977e0ccd (patch)
treef0dc2821c9df89780f98b6ab0b98b236056eda06 /chip
parentaca8db3d63a3521784d5b6ca38f285bc7680404d (diff)
downloadchrome-ec-84c97f043260e0b06b585ae2a46cc4e9977e0ccd.tar.gz
Replace __attribute__((noreturn)) with noreturn
_Noreturn was added in C11 and the convenience macro "noreturn" is specified by stdnoreturn.h: https://en.cppreference.com/w/c/language/_Noreturn. BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I30361bb5290cea1c776a7356f7e3a68edf1f8e39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324816 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/host/reboot.c2
-rw-r--r--chip/host/reboot.h4
-rw-r--r--chip/ish/power_mgt.c8
-rw-r--r--chip/ish/power_mgt.h6
-rw-r--r--chip/ish/system.c2
-rw-r--r--chip/mchp/lfw/ec_lfw.h7
-rw-r--r--chip/mchp/system.c5
-rw-r--r--chip/mec1322/lfw/ec_lfw.h4
-rw-r--r--chip/mec1322/system.c2
-rw-r--r--chip/npcx/system-npcx5.c6
-rw-r--r--chip/npcx/system-npcx7.c6
11 files changed, 34 insertions, 18 deletions
diff --git a/chip/host/reboot.c b/chip/host/reboot.c
index bc0d348255..e932c5f11a 100644
--- a/chip/host/reboot.c
+++ b/chip/host/reboot.c
@@ -20,7 +20,7 @@ void emulator_reboot(void)
ccprints("Emulator would reboot here. Fuzzing: doing nothing.");
}
#else /* !TEST_FUZZ */
-__attribute__((noreturn))
+noreturn
void emulator_reboot(void)
{
char *argv[] = {strdup(__get_prog_name()), NULL};
diff --git a/chip/host/reboot.h b/chip/host/reboot.h
index af04677d0d..1c1201f451 100644
--- a/chip/host/reboot.h
+++ b/chip/host/reboot.h
@@ -8,8 +8,10 @@
#ifndef __CROS_EC_REBOOT_H
#define __CROS_EC_REBOOT_H
+#include <stdnoreturn.h>
+
#ifndef TEST_FUZZ
-__attribute__((noreturn))
+noreturn
#endif
void emulator_reboot(void);
diff --git a/chip/ish/power_mgt.c b/chip/ish/power_mgt.c
index ca03d6c29a..6664b589a8 100644
--- a/chip/ish/power_mgt.c
+++ b/chip/ish/power_mgt.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <stdnoreturn.h>
+
#include "aontaskfw/ish_aon_share.h"
#include "console.h"
#include "hwtimer.h"
@@ -256,7 +258,7 @@ static void switch_to_aontask(void)
interrupt_enable();
}
-__attribute__ ((noreturn))
+noreturn
static void handle_reset_in_aontask(enum ish_pm_state pm_state)
{
pm_ctx.aon_share->pm_state = pm_state;
@@ -649,7 +651,7 @@ void ish_pm_init(void)
}
}
-__attribute__ ((noreturn))
+noreturn
void ish_pm_reset(enum ish_pm_state pm_state)
{
if (IS_ENABLED(CONFIG_ISH_PM_AONTASK) &&
@@ -756,7 +758,7 @@ DECLARE_IRQ(ISH_PMU_WAKEUP_IRQ, pmu_wakeup_isr);
*
*/
-__maybe_unused __attribute__ ((noreturn))
+__maybe_unused noreturn
static void reset_prep_isr(void)
{
/* mask reset prep avail interrupt */
diff --git a/chip/ish/power_mgt.h b/chip/ish/power_mgt.h
index 6144502286..a1fd5aabb6 100644
--- a/chip/ish/power_mgt.h
+++ b/chip/ish/power_mgt.h
@@ -6,6 +6,8 @@
#ifndef __CROS_EC_POWER_MGT_H
#define __CROS_EC_POWER_MGT_H
+#include <stdnoreturn.h>
+
#include "common.h"
#include "registers.h"
@@ -56,7 +58,7 @@ static inline void ish_mia_halt(void)
}
/* reset ISH mintue-ia cpu core */
-__attribute__((noreturn))
+noreturn
static inline void ish_mia_reset(void)
{
/**
@@ -81,7 +83,7 @@ __maybe_unused static void ish_pm_init(void)
/**
* reset ISH (reset minute-ia cpu core, and power off main SRAM)
*/
-void ish_pm_reset(enum ish_pm_state pm_state) __attribute__((noreturn));
+noreturn void ish_pm_reset(enum ish_pm_state pm_state);
/**
* notify the power management module that the UART for the console is in use.
diff --git a/chip/ish/system.c b/chip/ish/system.c
index caa5e15255..1e6fe87800 100644
--- a/chip/ish/system.c
+++ b/chip/ish/system.c
@@ -57,7 +57,7 @@ uint32_t chip_read_reset_flags(void)
* Used when the watchdog timer exceeds max retries and we want to
* disable ISH completely.
*/
-__attribute__((noreturn))
+noreturn
static void system_halt(void)
{
cflush();
diff --git a/chip/mchp/lfw/ec_lfw.h b/chip/mchp/lfw/ec_lfw.h
index 8d9da760a7..c989a3bc1b 100644
--- a/chip/mchp/lfw/ec_lfw.h
+++ b/chip/mchp/lfw/ec_lfw.h
@@ -6,6 +6,9 @@
*
*/
+#include <stdint.h>
+#include <stdnoreturn.h>
+
/* Why naked? This is dangerous except for
* function/ISR wrappers using inline assembly.
* lfw_main() makes many calls and has one local variable.
@@ -16,9 +19,9 @@
* We also do not know how much stack space is available when
* EC_RO calls lfw_main().
*
-void lfw_main(void) __attribute__ ((noreturn, naked));
+noreturn void lfw_main(void) __attribute__ ((naked));
*/
-void lfw_main(void) __attribute__ ((noreturn));
+noreturn void lfw_main(void);
void fault_handler(void) __attribute__((naked));
/*
diff --git a/chip/mchp/system.c b/chip/mchp/system.c
index 579d138d4b..1d152f0b79 100644
--- a/chip/mchp/system.c
+++ b/chip/mchp/system.c
@@ -5,6 +5,8 @@
/* System module for Chrome EC : MCHP hardware specific implementation */
+#include <stdnoreturn.h>
+
#include "clock.h"
#include "common.h"
#include "console.h"
@@ -210,8 +212,7 @@ void chip_save_reset_flags(uint32_t flags)
MCHP_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = flags;
}
-void __attribute__((noreturn)) _system_reset(int flags,
- int wake_from_hibernate)
+noreturn void _system_reset(int flags, int wake_from_hibernate)
{
uint32_t save_flags = 0;
diff --git a/chip/mec1322/lfw/ec_lfw.h b/chip/mec1322/lfw/ec_lfw.h
index b7f9f6359f..dd26fbd323 100644
--- a/chip/mec1322/lfw/ec_lfw.h
+++ b/chip/mec1322/lfw/ec_lfw.h
@@ -6,7 +6,9 @@
*
*/
-void lfw_main(void) __attribute__ ((noreturn, naked));
+#include <stdnoreturn.h>
+
+noreturn void lfw_main(void) __attribute__ ((naked));
void fault_handler(void) __attribute__((naked));
struct int_vector_t {
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index 9104bc17b1..a3043ba46b 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -105,7 +105,7 @@ uint32_t chip_read_reset_flags(void)
return MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS);
}
-__attribute__((noreturn))
+noreturn
void _system_reset(int flags, int wake_from_hibernate)
{
uint32_t save_flags = 0;
diff --git a/chip/npcx/system-npcx5.c b/chip/npcx/system-npcx5.c
index b991bb18b8..4dd12fbae2 100644
--- a/chip/npcx/system-npcx5.c
+++ b/chip/npcx/system-npcx5.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <stdnoreturn.h>
+
/* System module driver depends on chip series for Chrome EC */
#include "common.h"
#include "console.h"
@@ -59,7 +61,7 @@ void system_mpu_config(void)
/**
* hibernate function in low power ram for npcx5 series.
*/
-void __keep __attribute__ ((noreturn, section(".lowpower_ram")))
+noreturn void __keep __attribute__ ((section(".lowpower_ram")))
__enter_hibernate_in_lpram(void)
{
/*
@@ -146,7 +148,7 @@ void __hibernate_npcx_series(void)
#ifdef CONFIG_EXTERNAL_STORAGE
/* Sysjump utilities in low power ram for npcx5 series. */
-void __keep __attribute__ ((noreturn, section(".lowpower_ram2")))
+noreturn void __keep __attribute__ ((section(".lowpower_ram2")))
__start_gdma(uint32_t exeAddr)
{
/* Enable GDMA now */
diff --git a/chip/npcx/system-npcx7.c b/chip/npcx/system-npcx7.c
index 1ec719c641..ffc64bee41 100644
--- a/chip/npcx/system-npcx7.c
+++ b/chip/npcx/system-npcx7.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <stdnoreturn.h>
+
/* System module driver depends on chip series for Chrome EC */
#include "common.h"
#include "console.h"
@@ -57,7 +59,7 @@ void system_enter_psl_mode(void)
}
/* Hibernate function implemented by PSL (Power Switch Logic) mode. */
-void __keep __attribute__ ((noreturn)) __enter_hibernate_in_psl(void)
+noreturn void __keep __enter_hibernate_in_psl(void)
{
system_enter_psl_mode();
/* Spin and wait for PSL cuts power; should never return */
@@ -104,7 +106,7 @@ int system_config_psl_mode(enum gpio_signal signal)
* Hibernate function in last 32K ram block for npcx7 series.
* Do not use global variable since we also turn off data ram.
*/
-void __keep __attribute__ ((noreturn, section(".after_init")))
+noreturn void __keep __attribute__ ((section(".after_init")))
__enter_hibernate_in_last_block(void)
{
/*