Redirection of code assertions depending on user needs. Assert provides one of the following indirection for the assertion "SOPC_ASSERT" macro, depending on build flags:
More...
#include <assert.h>
Go to the source code of this file.
|
typedef void | SOPC_Assert_UserCallback(const char *context) |
| User-defined implementation of Fail-Safe behavior. This method shall be provided when WITH_USER_ASSERT is defined. This method shall not use any code implementation that relies on SOPC_ASSERT.
|
|
Redirection of code assertions depending on user needs. Assert provides one of the following indirection for the assertion "SOPC_ASSERT" macro, depending on build flags:
- WITH_NO_ASSERT The assertion is casted to void, so that tested variables are seen "used" by the compiler. This options aims at reducing code footprint by removing assertions. Note that this implies that SOPC_ASSERT calls must have no side-effect.
- WITH_USER_ASSERT The user can call (once) SOPC_Assert_Set_UserCallback to route failed asserts its own handling. This intends at providing a safety software event to set Fail-Safe behavior. If SOPC_Assert_Set_UserCallback is not called, or if the user callback returns, the failed assertion will simply call system assert with "false"
- Otherwise By default the system assertion is used (assert, see <assert.h>), but
◆ SOPC_PP_XSTR
#define SOPC_PP_XSTR |
( |
| x | ) |
|
Value:These macros are required to convert at build_time the LINE into a string
◆ SOPC_PP_STR
Value:
#define SOPC_PP_XSTR(x)
Definition sopc_assert.h:43
◆ WITH_MINIMAL_FOOTPRINT
#define WITH_MINIMAL_FOOTPRINT 0 |
◆ SOPC_ASSERT_CONTEXT
#define SOPC_ASSERT_CONTEXT |
( |
| context | ) |
|
Value:
#define SOPC_PP_STR(x)
Definition sopc_assert.h:44
SOPC_ASSERT_CONTEXT expands the calling context, only if WITH_MINIMAL_FOOTPRINT option is not set
◆ SOPC_ASSERT
#define SOPC_ASSERT assert |
SOPC_ASSERT implementation depends on build options (see module description)
◆ SOPC_Assert_UserCallback
typedef void SOPC_Assert_UserCallback(const char *context) |
User-defined implementation of Fail-Safe behavior. This method shall be provided when WITH_USER_ASSERT is defined. This method shall not use any code implementation that relies on SOPC_ASSERT.
- Parameters
-
context | The context of failed assertion. Note that when WITH_MINIMAL_FOOTPRINT option is set, this parameter will always be empty. |
- Postcondition
- This function has no constraint return (may return or not).
◆ SOPC_Assert_Set_UserCallback()
Define the user event to call in case of Assert failure.
- Parameters
-
◆ SOPC_Assert_Failure()
void SOPC_Assert_Failure |
( |
const char * | context | ) |
|
Called by SOPC_ASSERT in case of failure.
- Parameters
-
context | The context of failed assertion. |
- Postcondition
- This function does not return