mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:52:44 +01:00
core/assert: move common code to inline function
This commit is contained in:
parent
34222e1451
commit
3359f26689
@ -24,11 +24,12 @@
|
|||||||
#include "backtrace.h"
|
#include "backtrace.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__NORETURN void _assert_failure(const char *file, unsigned line)
|
__NORETURN static inline void _assert_common(void)
|
||||||
{
|
{
|
||||||
printf("%s:%u => ", file, line);
|
|
||||||
#if IS_USED(MODULE_BACKTRACE)
|
#if IS_USED(MODULE_BACKTRACE)
|
||||||
|
#ifdef DEBUG_ASSERT_VERBOSE
|
||||||
printf("failed assertion. Backtrace:\n");
|
printf("failed assertion. Backtrace:\n");
|
||||||
|
#endif
|
||||||
backtrace_print();
|
backtrace_print();
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG_ASSERT_BREAKPOINT
|
#ifdef DEBUG_ASSERT_BREAKPOINT
|
||||||
@ -37,16 +38,16 @@ __NORETURN void _assert_failure(const char *file, unsigned line)
|
|||||||
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
|
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__NORETURN void _assert_failure(const char *file, unsigned line)
|
||||||
|
{
|
||||||
|
printf("%s:%u => ", file, line);
|
||||||
|
_assert_common();
|
||||||
|
}
|
||||||
|
|
||||||
__NORETURN void _assert_panic(void)
|
__NORETURN void _assert_panic(void)
|
||||||
{
|
{
|
||||||
printf("%" PRIxTXTPTR "\n", cpu_get_caller_pc());
|
printf("%" PRIxTXTPTR "\n", cpu_get_caller_pc());
|
||||||
#if IS_USED(MODULE_BACKTRACE)
|
_assert_common();
|
||||||
backtrace_print();
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_ASSERT_BREAKPOINT
|
|
||||||
DEBUG_BREAKPOINT(1);
|
|
||||||
#endif
|
|
||||||
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
Loading…
Reference in New Issue
Block a user