Skip to content

Commit ef97121

Browse files
Thurnheercfriedt
authored andcommitted
lib: os: add gcc noreturn attribute for sys_reboot
sys_reboot doesn't return so mark it with noreturn Signed-off-by: Christoph Thurnheer <[email protected]>
1 parent fdc92eb commit ef97121

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/sys/reboot.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifndef ZEPHYR_INCLUDE_SYS_REBOOT_H_
1515
#define ZEPHYR_INCLUDE_SYS_REBOOT_H_
1616

17+
#include <toolchain.h>
18+
1719
#ifdef __cplusplus
1820
extern "C" {
1921
#endif
@@ -33,7 +35,7 @@ extern "C" {
3335
* @return N/A
3436
*/
3537

36-
extern void sys_reboot(int type);
38+
extern FUNC_NORETURN void sys_reboot(int type);
3739

3840
#ifdef __cplusplus
3941
}

lib/os/reboot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <sys/reboot.h>
78
#include <kernel.h>
89
#include <sys/printk.h>
910

1011
extern void sys_arch_reboot(int type);
1112
extern void sys_clock_disable(void);
1213

13-
void sys_reboot(int type)
14+
FUNC_NORETURN void sys_reboot(int type)
1415
{
1516
(void)irq_lock();
1617
#ifdef CONFIG_SYS_CLOCK_EXISTS

0 commit comments

Comments
 (0)