Skip to content

Commit

Permalink
macro EM_ASSERT_CONFIG_FILE for overriding of EFM_ASSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalGuenther committed Jan 26, 2022
1 parent 991121c commit 9eeb3a7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions platform/emlib/inc/em_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 9eeb3a7

Please sign in to comment.