Skip to content

Commit 29018ad

Browse files
authored
Merge pull request #10260 from jepler/noreturn-annotations
Mark functions as NORETURN
2 parents 9ec6c3a + deb5348 commit 29018ad

File tree

9 files changed

+10
-8
lines changed

9 files changed

+10
-8
lines changed

ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
#include "shared-bindings/alarm/touch/TouchAlarm.h"
88
#include "shared-bindings/microcontroller/__init__.h"
99

10-
void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) {
10+
NORETURN void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) {
1111
mp_raise_NotImplementedError_varg(MP_ERROR_TEXT("%q"), MP_QSTR_TouchAlarm);
1212
}

ports/atmel-samd/supervisor/port.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void port_idle_until_interrupt(void) {
686686
/**
687687
* \brief Default interrupt handler for unused IRQs.
688688
*/
689-
__attribute__((used)) void HardFault_Handler(void) {
689+
__attribute__((used)) NORETURN void HardFault_Handler(void) {
690690
#ifdef ENABLE_MICRO_TRACE_BUFFER
691691
// Turn off the micro trace buffer so we don't fill it up in the infinite
692692
// loop below.

ports/broadcom/common-hal/microcontroller/__init__.c

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "common-hal/microcontroller/__init__.h"
1212
#include "peripherals/broadcom/defines.h"
1313
#include "peripherals/broadcom/interrupts.h"
14+
#include "supervisor/port.h"
1415

1516
#include "mphalport.h"
1617

@@ -39,6 +40,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
3940
}
4041

4142
void common_hal_mcu_reset(void) {
43+
reset_cpu();
4244
}
4345

4446
// The singleton microcontroller.Processor object, bound to microcontroller.cpu

ports/raspberrypi/supervisor/port.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void port_idle_until_interrupt(void) {
572572
/**
573573
* \brief Default interrupt handler for unused IRQs.
574574
*/
575-
extern void isr_hardfault(void); // provide a prototype to avoid a missing-prototypes diagnostic
575+
extern NORETURN void isr_hardfault(void); // provide a prototype to avoid a missing-prototypes diagnostic
576576
__attribute__((used)) void __not_in_flash_func(isr_hardfault)(void) {
577577
// Only safe mode from core 0 which is running CircuitPython. Core 1 faulting
578578
// should not be fatal to CP. (Fingers crossed.)

shared-bindings/alarm/time/TimeAlarm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "shared-bindings/time/__init__.h"
1515

1616
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
17-
mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
17+
NORETURN mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
1818
mp_raise_RuntimeError(MP_ERROR_TEXT("RTC is not supported on this board"));
1919
}
2020
#endif

shared-bindings/microcontroller/__init__.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern void common_hal_mcu_disable_interrupts(void);
2020
extern void common_hal_mcu_enable_interrupts(void);
2121

2222
extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode);
23-
extern void common_hal_mcu_reset(void);
23+
NORETURN extern void common_hal_mcu_reset(void);
2424

2525
extern const mp_obj_dict_t mcu_pin_globals;
2626

shared-bindings/storage/__init__.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void common_hal_storage_umount_path(const char *path);
1616
void common_hal_storage_umount_object(mp_obj_t vfs_obj);
1717
void common_hal_storage_remount(const char *path, bool readonly, bool disable_concurrent_write_protection);
1818
mp_obj_t common_hal_storage_getmount(const char *path);
19-
void common_hal_storage_erase_filesystem(bool extended);
19+
NORETURN void common_hal_storage_erase_filesystem(bool extended);
2020

2121
bool common_hal_storage_disable_usb_drive(void);
2222
bool common_hal_storage_enable_usb_drive(void);

shared-bindings/time/__init__.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_not_implemented_obj, time_not_implemented);
172172
#endif
173173

174174
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
175-
mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
175+
NORETURN mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
176176
mp_raise_RuntimeError(MP_ERROR_TEXT("RTC is not supported on this board"));
177177
}
178178

shared-bindings/util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
#include "py/mpprint.h"
1010
#include "py/runtime.h"
1111

12-
void raise_deinited_error(void);
12+
NORETURN void raise_deinited_error(void);
1313
void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp_arg_t *properties, size_t n_properties);
1414
void properties_construct_helper(mp_obj_t self_in, const mp_arg_t *args, const mp_arg_val_t *vals, size_t n_properties);

0 commit comments

Comments
 (0)