From 9eeb3a70ca7da3a025528189b482f78ac8648e0a Mon Sep 17 00:00:00 2001 From: PascalGuenther Date: Wed, 26 Jan 2022 17:29:51 +0100 Subject: [PATCH] macro EM_ASSERT_CONFIG_FILE for overriding of EFM_ASSERT --- platform/emlib/inc/em_assert.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/emlib/inc/em_assert.h b/platform/emlib/inc/em_assert.h index de340d54c5..bce2452781 100644 --- a/platform/emlib/inc/em_assert.h +++ b/platform/emlib/inc/em_assert.h @@ -31,6 +31,10 @@ #ifndef EM_ASSERT_H #define EM_ASSERT_H +#if defined(EM_ASSERT_CONFIG_FILE) +#include EM_ASSERT_CONFIG_FILE +#endif + #ifdef __cplusplus extern "C" { #endif @@ -74,10 +78,19 @@ extern "C" { /* not the assert expression (nor function name (C99)) */ void assertEFM(const char *file, int line); /** Default assertion is not operational */ + +#if !defined(EFM_ASSERT_USER) + #define EFM_ASSERT(expr) ((expr) ? ((void)0) : assertEFM(__FILE__, __LINE__)) #else +#define EFM_ASSERT(expr) EFM_ASSERT_USER(expr) + +#endif /* !defined(EFM_ASSERT_USER) */ + +#else + /** Default assertion is not operational */ #define EFM_ASSERT(expr) ((void)(expr))