Merge pull request #710 from iabdalkader/assert

Fix assert_func warning/error
This commit is contained in:
Damien George 2014-06-30 09:09:24 +01:00
commit 4039a26679
2 changed files with 7 additions and 3 deletions

View File

@ -404,3 +404,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

@ -86,7 +86,7 @@ void flash_error(int n) {
led_state(PYB_LED_R2, 0); led_state(PYB_LED_R2, 0);
} }
void __fatal_error(const char *msg) { void NORETURN __fatal_error(const char *msg) {
for (volatile uint delay = 0; delay < 10000000; delay++) { for (volatile uint delay = 0; delay < 10000000; delay++) {
} }
led_state(1, 1); led_state(1, 1);
@ -112,8 +112,7 @@ 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("");