From 882c21bf0bb8f7b534ca36500ec14f01a2de7ecf Mon Sep 17 00:00:00 2001 From: Kimmo Vaisanen Date: Wed, 31 Jul 2019 15:06:28 +0300 Subject: [PATCH] Fix MBED_ASSERT for UTs For UTs mbed_assert_internal should not be declared as MBED_NORETURN as UT stub for mbed_assert_internal only prints out the assert trace and returns back to original code. --- UNITTESTS/target_h/platform/mbed_assert.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UNITTESTS/target_h/platform/mbed_assert.h b/UNITTESTS/target_h/platform/mbed_assert.h index c52a0173e2e..3d7a8a24d86 100644 --- a/UNITTESTS/target_h/platform/mbed_assert.h +++ b/UNITTESTS/target_h/platform/mbed_assert.h @@ -39,7 +39,12 @@ extern "C" { * @param file File where assertation failed. * @param line Failing assertation line number. */ -MBED_NORETURN void mbed_assert_internal(const char *expr, const char *file, int line); +// mbed_assert_internal UT stub only prints an assert trace and returns, so therefore +// MBED_NORETURN must not be defined for UTs. +#ifndef UNITTEST +MBED_NORETURN +#endif +void mbed_assert_internal(const char *expr, const char *file, int line); #ifdef __cplusplus } @@ -132,4 +137,3 @@ do { \ /**@}*/ /**@}*/ -