Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro EM_ASSERT_CONFIG_FILE for overriding of EFM_ASSERT #2

Open
wants to merge 1 commit into
base: gsdk_4.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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