1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/assert: move common code to inline function

This commit is contained in:
Benjamin Valentin 2024-04-26 14:07:24 +02:00
parent 34222e1451
commit 3359f26689

View File

@ -24,11 +24,12 @@
#include "backtrace.h"
#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)
#ifdef DEBUG_ASSERT_VERBOSE
printf("failed assertion. Backtrace:\n");
#endif
backtrace_print();
#endif
#ifdef DEBUG_ASSERT_BREAKPOINT
@ -37,16 +38,16 @@ __NORETURN void _assert_failure(const char *file, unsigned line)
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)
{
printf("%" PRIxTXTPTR "\n", cpu_get_caller_pc());
#if IS_USED(MODULE_BACKTRACE)
backtrace_print();
#endif
#ifdef DEBUG_ASSERT_BREAKPOINT
DEBUG_BREAKPOINT(1);
#endif
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
_assert_common();
}
/** @} */