Skip to content

Commit 4039a26

Browse files
committed
Merge pull request adafruit#710 from iabdalkader/assert
Fix assert_func warning/error
2 parents b601d95 + 89b38d9 commit 4039a26

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,8 @@ typedef double mp_float_t;
404404
#ifndef NORETURN
405405
#define NORETURN __attribute__((noreturn))
406406
#endif
407+
408+
// Modifier for weak functions
409+
#ifndef MP_WEAK
410+
#define MP_WEAK __attribute__((weak))
411+
#endif

stmhal/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void flash_error(int n) {
8686
led_state(PYB_LED_R2, 0);
8787
}
8888

89-
void __fatal_error(const char *msg) {
89+
void NORETURN __fatal_error(const char *msg) {
9090
for (volatile uint delay = 0; delay < 10000000; delay++) {
9191
}
9292
led_state(1, 1);
@@ -112,8 +112,7 @@ void nlr_jump_fail(void *val) {
112112
}
113113

114114
#ifndef NDEBUG
115-
void __attribute__((weak))
116-
__assert_func(const char *file, int line, const char *func, const char *expr) {
115+
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
117116
(void)func;
118117
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
119118
__fatal_error("");

0 commit comments

Comments
 (0)