Fix asser_func warning/error

* Add while(1) to assert_func to avoid func returns warning
* Define a weak attr in mpconfig.h
This commit is contained in:
mux 2014-06-21 17:24:55 +02:00
parent 4c4b9d15ab
commit 5c8db48541
2 changed files with 7 additions and 2 deletions

View File

@ -381,3 +381,8 @@ typedef double mp_float_t;
#ifndef NORETURN #ifndef NORETURN
#define NORETURN __attribute__((noreturn)) #define NORETURN __attribute__((noreturn))
#endif #endif
// Modifier for weak functions
#ifndef MP_WEAK
#define MP_WEAK __attribute__((weak))
#endif

View File

@ -111,11 +111,11 @@ void nlr_jump_fail(void *val) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void __attribute__((weak)) void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
__assert_func(const char *file, int line, const char *func, const char *expr) {
(void)func; (void)func;
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line); printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
__fatal_error(""); __fatal_error("");
while (1);
} }
#endif #endif