Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mark functions as NORETURN #10260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
#include "shared-bindings/alarm/touch/TouchAlarm.h"
#include "shared-bindings/microcontroller/__init__.h"

void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) {
NORETURN void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) {
mp_raise_NotImplementedError_varg(MP_ERROR_TEXT("%q"), MP_QSTR_TouchAlarm);
}
2 changes: 1 addition & 1 deletion ports/atmel-samd/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void port_idle_until_interrupt(void) {
/**
* \brief Default interrupt handler for unused IRQs.
*/
__attribute__((used)) void HardFault_Handler(void) {
__attribute__((used)) NORETURN void HardFault_Handler(void) {
#ifdef ENABLE_MICRO_TRACE_BUFFER
// Turn off the micro trace buffer so we don't fill it up in the infinite
// loop below.
Expand Down
2 changes: 2 additions & 0 deletions ports/broadcom/common-hal/microcontroller/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "common-hal/microcontroller/__init__.h"
#include "peripherals/broadcom/defines.h"
#include "peripherals/broadcom/interrupts.h"
#include "supervisor/port.h"

#include "mphalport.h"

Expand Down Expand Up @@ -39,6 +40,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
}

void common_hal_mcu_reset(void) {
reset_cpu();
}

// The singleton microcontroller.Processor object, bound to microcontroller.cpu
Expand Down
2 changes: 1 addition & 1 deletion ports/raspberrypi/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void port_idle_until_interrupt(void) {
/**
* \brief Default interrupt handler for unused IRQs.
*/
extern void isr_hardfault(void); // provide a prototype to avoid a missing-prototypes diagnostic
extern NORETURN void isr_hardfault(void); // provide a prototype to avoid a missing-prototypes diagnostic
__attribute__((used)) void __not_in_flash_func(isr_hardfault)(void) {
// Only safe mode from core 0 which is running CircuitPython. Core 1 faulting
// should not be fatal to CP. (Fingers crossed.)
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/alarm/time/TimeAlarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "shared-bindings/time/__init__.h"

#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
NORETURN mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
mp_raise_RuntimeError(MP_ERROR_TEXT("RTC is not supported on this board"));
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/microcontroller/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern void common_hal_mcu_disable_interrupts(void);
extern void common_hal_mcu_enable_interrupts(void);

extern void common_hal_mcu_on_next_reset(mcu_runmode_t runmode);
extern void common_hal_mcu_reset(void);
NORETURN extern void common_hal_mcu_reset(void);

extern const mp_obj_dict_t mcu_pin_globals;

Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/storage/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void common_hal_storage_umount_path(const char *path);
void common_hal_storage_umount_object(mp_obj_t vfs_obj);
void common_hal_storage_remount(const char *path, bool readonly, bool disable_concurrent_write_protection);
mp_obj_t common_hal_storage_getmount(const char *path);
void common_hal_storage_erase_filesystem(bool extended);
NORETURN void common_hal_storage_erase_filesystem(bool extended);

bool common_hal_storage_disable_usb_drive(void);
bool common_hal_storage_enable_usb_drive(void);
2 changes: 1 addition & 1 deletion shared-bindings/time/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_not_implemented_obj, time_not_implemented);
#endif

#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
NORETURN mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
mp_raise_RuntimeError(MP_ERROR_TEXT("RTC is not supported on this board"));
}

Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#include "py/mpprint.h"
#include "py/runtime.h"

void raise_deinited_error(void);
NORETURN void raise_deinited_error(void);
void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp_arg_t *properties, size_t n_properties);
void properties_construct_helper(mp_obj_t self_in, const mp_arg_t *args, const mp_arg_val_t *vals, size_t n_properties);
Loading