Skip to content

Commit 5c8db48

Browse files
committed
Fix asser_func warning/error
* Add while(1) to assert_func to avoid func returns warning * Define a weak attr in mpconfig.h
1 parent 4c4b9d1 commit 5c8db48

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,8 @@ typedef double mp_float_t;
381381
#ifndef NORETURN
382382
#define NORETURN __attribute__((noreturn))
383383
#endif
384+
385+
// Modifier for weak functions
386+
#ifndef MP_WEAK
387+
#define MP_WEAK __attribute__((weak))
388+
#endif

stmhal/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ void nlr_jump_fail(void *val) {
111111
}
112112

113113
#ifndef NDEBUG
114-
void __attribute__((weak))
115-
__assert_func(const char *file, int line, const char *func, const char *expr) {
114+
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
116115
(void)func;
117116
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
118117
__fatal_error("");
118+
while (1);
119119
}
120120
#endif
121121

0 commit comments

Comments
 (0)