ASSERTEMLIB

Detailed Description

Error checking module.

By default, EMLIB library assert usage is not included in order to reduce footprint and processing overhead. Further, EMLIB assert usage is decoupled from ISO C assert handling (NDEBUG usage), to allow a user to use ISO C assert without including EMLIB assert statements.

Below are available defines for controlling EMLIB assert inclusion. The defines are typically defined for a project to be used by the preprocessor.

  • If DEBUG_EFM is defined, the internal EMLIB library assert handling will be used. This is implemented as a simple while(true) loop. DEBUG_EFM is not defined by default.
  • If DEBUG_EFM_USER is defined instead, the user must provide their own implementation of the assertEFM() function.
  • If both DEBUG_EFM and DEBUG_EFM_USER are undefined then all EFM_ASSERT() statements are no operation.
Note
The internal EMLIB assert is documented here because DEBUG_EFM is defined in the doxygen configuration.

Macros

#define EFM_ASSERT (expr)    ((expr) ? ((void)0) : assertEFM (__FILE__, __LINE__))

Functions

void assertEFM (const char *file, int line)
EFM internal assert handling.

Function Documentation

void assertEFM ( const char * file,
int line
)

EFM internal assert handling.

This function is invoked through EFM_ASSERT() macro usage only, it should not be used explicitly.

This implementation simply enters an indefinite loop, allowing the use of a debugger to determine cause of failure. By defining DEBUG_EFM_USER to the preprocessor for all files, a user defined version of this function must be defined and will be invoked instead, possibly providing output of assertion location.

Note
This function is not used unless DEBUG_EFM is defined during preprocessing of EFM_ASSERT() usage.
Parameters
[in] file Name of source file where assertion failed.
[in] line Line number in source file where assertion failed.

Definition at line 70 of file em_assert.c .