Skip to content

Commit

Permalink
Merge pull request #892 from OlegHahm/crash_noreturn
Browse files Browse the repository at this point in the history
cpu: satisfy compiler in crash.c for ARM and MSP430
  • Loading branch information
rousselk committed Apr 9, 2014
2 parents ab08fbb + aeb5415 commit f302491
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
10 changes: 10 additions & 0 deletions cpu/arm_common/crash.c
Expand Up @@ -60,4 +60,14 @@ NORETURN void core_panic(int crash_code, const char *message)
/* DEVELHELP not set => reboot system */
(void) reboot(RB_AUTOBOOT);
#endif

/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5)
__builtin_unreachable();
#else
while (1) {
/* do nothing, but do it often */
}
#endif
}
10 changes: 10 additions & 0 deletions cpu/lpc1768/crash.c
Expand Up @@ -61,4 +61,14 @@ NORETURN void core_panic(int crash_code, const char *message)
/* DEVELHELP not set => reboot system */
(void) reboot(RB_AUTOBOOT);
#endif

/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5)
__builtin_unreachable();
#else
while (1) {
/* do nothing, but do it often */
}
#endif
}
10 changes: 10 additions & 0 deletions cpu/msp430-common/crash.c
Expand Up @@ -60,4 +60,14 @@ NORETURN void core_panic(int crash_code, const char *message)
/* DEVELHELP not set => reboot system */
(void) reboot(RB_AUTOBOOT);
#endif

/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5)
__builtin_unreachable();
#else
while (1) {
/* do nothing, but do it often */
}
#endif
}
8 changes: 6 additions & 2 deletions cpu/native/crash.c
Expand Up @@ -58,9 +58,13 @@ NORETURN void core_panic(int crash_code, const char *message)
(void) reboot(RB_AUTOBOOT);
#endif

/* proove the compiler that we won't return from this function
/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 5)
__builtin_unreachable();
#else
while (1) {
/* nothing in particular */;
/* do nothing, but do it often */
}
#endif
}

0 comments on commit f302491

Please sign in to comment.