Skip to content

Commit f47e214

Browse files
agattidpgeorge
authored andcommitted
all: Rename the "NORETURN" macro to "MP_NORETURN".
This commit renames the NORETURN macro, indicating to the compiler that a function does not return, into MP_NORETURN to maintain the same naming convention of other similar macros. To maintain compaitiblity with existing code NORETURN is aliased to MP_NORETURN, but it is also deprecated for MicroPython v2. This changeset was created using a similar process to decf8e6 ("all: Remove the "STATIC" macro and just use "static" instead."), with no documentation or python scripts to change to reflect the new macro name. Signed-off-by: Alessandro Gatti <[email protected]>
1 parent 69993da commit f47e214

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+159
-155
lines changed

extmod/modmachine.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
static void mp_machine_idle(void);
4646

4747
#if MICROPY_PY_MACHINE_BOOTLOADER
48-
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args);
48+
MP_NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args);
4949
#endif
5050

5151
#if MICROPY_PY_MACHINE_RESET
52-
NORETURN static void mp_machine_reset(void);
52+
MP_NORETURN static void mp_machine_reset(void);
5353
static mp_int_t mp_machine_reset_cause(void);
5454
#endif
5555

@@ -58,7 +58,7 @@ static mp_obj_t mp_machine_unique_id(void);
5858
static mp_obj_t mp_machine_get_freq(void);
5959
static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args);
6060
static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args);
61-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
61+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
6262
#endif
6363

6464
// The port can provide additional machine-module implementation in this file.
@@ -67,7 +67,7 @@ NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
6767
#endif
6868

6969
#if MICROPY_PY_MACHINE_BOOTLOADER
70-
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
70+
MP_NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
7171
mp_machine_bootloader(n_args, args);
7272
}
7373
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bootloader_obj, 0, 1, machine_bootloader);
@@ -81,7 +81,7 @@ static MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
8181

8282
#if MICROPY_PY_MACHINE_RESET
8383

84-
NORETURN static mp_obj_t machine_reset(void) {
84+
MP_NORETURN static mp_obj_t machine_reset(void) {
8585
mp_machine_reset();
8686
}
8787
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
@@ -116,7 +116,7 @@ static mp_obj_t machine_lightsleep(size_t n_args, const mp_obj_t *args) {
116116
}
117117
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lightsleep_obj, 0, 1, machine_lightsleep);
118118

119-
NORETURN static mp_obj_t machine_deepsleep(size_t n_args, const mp_obj_t *args) {
119+
MP_NORETURN static mp_obj_t machine_deepsleep(size_t n_args, const mp_obj_t *args) {
120120
mp_machine_deepsleep(n_args, args);
121121
}
122122
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_deepsleep_obj, 0, 1, machine_deepsleep);

extmod/modmachine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ uintptr_t MICROPY_MACHINE_MEM_GET_READ_ADDR(mp_obj_t addr_o, uint align);
242242
uintptr_t MICROPY_MACHINE_MEM_GET_WRITE_ADDR(mp_obj_t addr_o, uint align);
243243
#endif
244244

245-
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);
245+
MP_NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);
246246
void machine_bitstream_high_low(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len);
247247
mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us);
248248

extmod/modtls_axtls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static const char *const ssl_error_tab2[] = {
105105
"NOT_SUPPORTED",
106106
};
107107

108-
static NORETURN void ssl_raise_error(int err) {
108+
static MP_NORETURN void ssl_raise_error(int err) {
109109
MP_STATIC_ASSERT(SSL_NOT_OK - 3 == SSL_EAGAIN);
110110
MP_STATIC_ASSERT(SSL_ERROR_CONN_LOST - 18 == SSL_ERROR_NOT_SUPPORTED);
111111

extmod/modtls_mbedtls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static const unsigned char *asn1_get_data(mp_obj_t obj, size_t *out_len) {
147147
return (const unsigned char *)str;
148148
}
149149

150-
static NORETURN void mbedtls_raise_error(int err) {
150+
static MP_NORETURN void mbedtls_raise_error(int err) {
151151
// Handle special cases.
152152
if (err == MBEDTLS_ERR_SSL_ALLOC_FAILED) {
153153
mp_raise_OSError(MP_ENOMEM);

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ typedef struct _mp_obj_uctypes_struct_t {
8989
uint32_t flags;
9090
} mp_obj_uctypes_struct_t;
9191

92-
static NORETURN void syntax_error(void) {
92+
static MP_NORETURN void syntax_error(void) {
9393
mp_raise_TypeError(MP_ERROR_TEXT("syntax error in uctypes descriptor"));
9494
}
9595

mpy-cross/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ typedef long mp_off_t;
137137
#ifdef _MSC_VER
138138

139139
#define MP_ENDIANNESS_LITTLE (1)
140-
#define NORETURN __declspec(noreturn)
140+
#define MP_NORETURN __declspec(noreturn)
141141
#define MP_NOINLINE __declspec(noinline)
142142
#define MP_ALWAYSINLINE __forceinline
143143
#define MP_LIKELY(x) (x)

ports/alif/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
extern uint8_t __StackTop, __StackLimit;
5757
extern uint8_t __GcHeapStart, __GcHeapEnd;
5858

59-
NORETURN void panic(const char *msg) {
59+
MP_NORETURN void panic(const char *msg) {
6060
mp_hal_stdout_tx_strn("\nFATAL ERROR:\n", 14);
6161
mp_hal_stdout_tx_strn(msg, strlen(msg));
6262
for (;;) {

ports/alif/modmachine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ static mp_obj_t mp_machine_unique_id(void) {
4747
return mp_obj_new_bytes(id, sizeof(id));
4848
}
4949

50-
NORETURN static void mp_machine_reset(void) {
50+
MP_NORETURN static void mp_machine_reset(void) {
5151
se_services_reset_soc();
5252
}
5353

54-
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
54+
MP_NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
5555
__disable_irq();
5656

5757
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
@@ -112,7 +112,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
112112
#endif
113113
}
114114

115-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
115+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
116116
#if MICROPY_HW_ENABLE_USBDEV
117117
mp_machine_enable_usb(false);
118118
#endif

ports/cc3200/misc/mperror.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void mperror_heartbeat_signal (void) {
159159
}
160160
}
161161

162-
void NORETURN __fatal_error(const char *msg) {
162+
void MP_NORETURN __fatal_error(const char *msg) {
163163
#ifdef DEBUG
164164
if (msg != NULL) {
165165
// wait for 20ms

ports/cc3200/misc/mperror.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#ifndef MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
2828
#define MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
2929

30-
extern void NORETURN __fatal_error(const char *msg);
30+
extern void MP_NORETURN __fatal_error(const char *msg);
3131

3232
void mperror_init0 (void);
3333
void mperror_bootloader_check_reset_cause (void);

ports/cc3200/mods/modmachine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
9393
/******************************************************************************/
9494
// MicroPython bindings;
9595

96-
NORETURN static void mp_machine_reset(void) {
96+
MP_NORETURN static void mp_machine_reset(void) {
9797
// disable wlan
9898
wlan_stop(SL_STOP_TIMEOUT_LONG);
9999
// reset the cpu and it's peripherals
@@ -161,7 +161,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
161161
pyb_sleep_sleep();
162162
}
163163

164-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
164+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
165165
pyb_sleep_deepsleep();
166166
for (;;) {
167167
}

ports/cc3200/mods/pybsleep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static MP_DEFINE_CONST_OBJ_TYPE(
136136
******************************************************************************/
137137
static pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj);
138138
static void pyb_sleep_flash_powerdown (void);
139-
static NORETURN void pyb_sleep_suspend_enter (void);
139+
static MP_NORETURN void pyb_sleep_suspend_enter (void);
140140
void pyb_sleep_suspend_exit (void);
141141
static void pyb_sleep_obj_wakeup (void);
142142
static void PRCMInterruptHandler (void);
@@ -360,7 +360,7 @@ static void pyb_sleep_flash_powerdown (void) {
360360
MAP_SPICSDisable(SSPI_BASE);
361361
}
362362

363-
static NORETURN void pyb_sleep_suspend_enter (void) {
363+
static MP_NORETURN void pyb_sleep_suspend_enter (void) {
364364
// enable full RAM retention
365365
MAP_PRCMSRAMRetentionEnable(PRCM_SRAM_COL_1 | PRCM_SRAM_COL_2 | PRCM_SRAM_COL_3 | PRCM_SRAM_COL_4, PRCM_SRAM_LPDS_RET);
366366

ports/esp32/modmachine.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
178178
machine_sleep_helper(MACHINE_WAKE_SLEEP, n_args, args);
179179
};
180180

181-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
181+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
182182
machine_sleep_helper(MACHINE_WAKE_DEEPSLEEP, n_args, args);
183183
mp_machine_reset();
184184
};
@@ -221,7 +221,7 @@ static mp_int_t mp_machine_reset_cause(void) {
221221
#include "esp32s3/rom/usb/chip_usb_dw_wrapper.h"
222222
#endif
223223

224-
NORETURN static void machine_bootloader_rtc(void) {
224+
MP_NORETURN static void machine_bootloader_rtc(void) {
225225
#if CONFIG_IDF_TARGET_ESP32S3 && MICROPY_HW_USB_CDC
226226
usb_usj_mode();
227227
usb_dc_prepare_persist();
@@ -233,7 +233,7 @@ NORETURN static void machine_bootloader_rtc(void) {
233233
#endif
234234

235235
#ifdef MICROPY_BOARD_ENTER_BOOTLOADER
236-
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
236+
MP_NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
237237
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
238238
for (;;) {
239239
}
@@ -254,7 +254,7 @@ static mp_obj_t machine_wake_reason(size_t n_args, const mp_obj_t *pos_args, mp_
254254
}
255255
static MP_DEFINE_CONST_FUN_OBJ_KW(machine_wake_reason_obj, 0, machine_wake_reason);
256256

257-
NORETURN static void mp_machine_reset(void) {
257+
MP_NORETURN static void mp_machine_reset(void) {
258258
esp_restart();
259259
}
260260

ports/esp32/modnetwork.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(esp_network_phy_mode_obj);
6161

6262
mp_obj_t esp_ifname(esp_netif_t *netif);
6363

64-
NORETURN void esp_exceptions_helper(esp_err_t e);
64+
MP_NORETURN void esp_exceptions_helper(esp_err_t e);
6565

6666
static inline void esp_exceptions(esp_err_t e) {
6767
if (e != ESP_OK) {

ports/esp32/network_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include "lwip/sockets.h"
4646
#include "lwip/dns.h"
4747

48-
NORETURN void esp_exceptions_helper(esp_err_t e) {
48+
MP_NORETURN void esp_exceptions_helper(esp_err_t e) {
4949
switch (e) {
5050
case ESP_ERR_WIFI_NOT_INIT:
5151
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Wifi Not Initialized"));

ports/esp8266/esp_init_data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "user_interface.h"
3131
#include "extmod/misc.h"
3232

33-
NORETURN void call_user_start(void);
33+
MP_NORETURN void call_user_start(void);
3434
void ets_printf(const char *fmt, ...);
3535
extern char flashchip;
3636

ports/esp8266/modmachine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
7171
system_update_cpu_freq(freq);
7272
}
7373

74-
NORETURN static void mp_machine_reset(void) {
74+
MP_NORETURN static void mp_machine_reset(void) {
7575
system_restart();
7676

7777
// we must not return
@@ -114,7 +114,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
114114
}
115115
}
116116

117-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
117+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
118118
// default to sleep forever
119119
uint32_t sleep_us = 0;
120120

ports/mimxrt/modmachine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static mp_obj_t mp_machine_unique_id(void) {
8787
return mp_obj_new_bytes(id, sizeof(id));
8888
}
8989

90-
NORETURN static void mp_machine_reset(void) {
90+
MP_NORETURN static void mp_machine_reset(void) {
9191
WDOG_TriggerSystemSoftwareReset(WDOG1);
9292
while (true) {
9393
;
@@ -131,7 +131,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
131131
mp_raise_NotImplementedError(NULL);
132132
}
133133

134-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
134+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
135135
if (n_args != 0) {
136136
mp_int_t seconds = mp_obj_get_int(args[0]) / 1000;
137137
if (seconds > 0) {
@@ -159,7 +159,7 @@ NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
159159
}
160160
}
161161

162-
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
162+
MP_NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
163163
#if defined(MICROPY_BOARD_ENTER_BOOTLOADER)
164164
// If a board has a custom bootloader, call it first.
165165
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);

ports/minimal/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void nlr_jump_fail(void *val) {
8787
}
8888
}
8989

90-
void NORETURN __fatal_error(const char *msg) {
90+
void MP_NORETURN __fatal_error(const char *msg) {
9191
while (1) {
9292
;
9393
}

ports/nrf/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) {
107107
extern uint32_t _heap_start;
108108
extern uint32_t _heap_end;
109109

110-
void NORETURN _start(void) {
110+
void MP_NORETURN _start(void) {
111111
// Hook for a board to run code at start up, for example check if a
112112
// bootloader should be entered instead of the main application.
113113
MICROPY_BOARD_STARTUP();
@@ -353,7 +353,7 @@ void HardFault_Handler(void) {
353353
#endif
354354
}
355355

356-
void NORETURN __fatal_error(const char *msg) {
356+
void MP_NORETURN __fatal_error(const char *msg) {
357357
while (1) {
358358
;
359359
}

ports/nrf/modules/machine/modmachine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ static mp_obj_t mp_machine_unique_id(void) {
181181
}
182182

183183
// Resets the board in a manner similar to pushing the external RESET button.
184-
NORETURN static void mp_machine_reset(void) {
184+
MP_NORETURN static void mp_machine_reset(void) {
185185
NVIC_SystemReset();
186186
}
187187

188-
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
188+
MP_NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
189189
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
190190
for (;;) {
191191
}
@@ -199,7 +199,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
199199
__WFE();
200200
}
201201

202-
NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
202+
MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
203203
mp_machine_reset();
204204
}
205205

ports/nrf/mphalport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const byte mp_hal_status_to_errno_table[4] = {
202202
[HAL_TIMEOUT] = MP_ETIMEDOUT,
203203
};
204204

205-
NORETURN void mp_hal_raise(HAL_StatusTypeDef status) {
205+
MP_NORETURN void mp_hal_raise(HAL_StatusTypeDef status) {
206206
mp_raise_OSError(mp_hal_status_to_errno_table[status]);
207207
}
208208

ports/nrf/mphalport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extern const unsigned char mp_hal_status_to_errno_table[4];
4747

4848
extern ringbuf_t stdin_ringbuf;
4949

50-
NORETURN void mp_hal_raise(HAL_StatusTypeDef status);
50+
MP_NORETURN void mp_hal_raise(HAL_StatusTypeDef status);
5151
void mp_hal_set_interrupt_char(int c); // -1 to disable
5252

5353
int mp_hal_stdin_rx_chr(void);

ports/pic16bit/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void nlr_jump_fail(void *val) {
121121
}
122122
}
123123

124-
void NORETURN __fatal_error(const char *msg) {
124+
void MP_NORETURN __fatal_error(const char *msg) {
125125
while (1) {
126126
;
127127
}

ports/powerpc/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void nlr_jump_fail(void *val) {
130130
}
131131
}
132132

133-
void NORETURN __fatal_error(const char *msg) {
133+
void MP_NORETURN __fatal_error(const char *msg) {
134134
while (1) {
135135
;
136136
}

0 commit comments

Comments
 (0)