Merge pull request #710 from iabdalkader/assert

Fix assert_func warning/error
nlr-macros
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
#define NORETURN __attribute__((noreturn))
#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);
}
void __fatal_error(const char *msg) {
void NORETURN __fatal_error(const char *msg) {
for (volatile uint delay = 0; delay < 10000000; delay++) {
}
led_state(1, 1);
@ -112,8 +112,7 @@ void nlr_jump_fail(void *val) {
}
#ifndef NDEBUG
void __attribute__((weak))
__assert_func(const char *file, int line, const char *func, const char *expr) {
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
(void)func;
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
__fatal_error("");