PebbleOS
Loading...
Searching...
No Matches
Macros | Functions
Library assertions

Assertions of the utility library. More...

Macros

#define UTIL_ASSERT(expr)
 Assert that an expression is true.
 

Functions

void util_assertion_failed (const char *filename, int line)
 Handle a failed UTIL_ASSERT().
 

Detailed Description

Assertions of the utility library.

Macro Definition Documentation

◆ UTIL_ASSERT

#define UTIL_ASSERT (   expr)
Value:
do { \
if (PBL_UNLIKELY(!(expr))) { \
util_assertion_failed(__FILE_NAME__, __LINE__); \
} \
} while (0)
#define PBL_UNLIKELY(x)
Branch prediction hint for a condition that is unlikely to hold.
Definition compiler.h:148

Assert that an expression is true.

Always enabled.

Parameters
exprExpression.

Function Documentation

◆ util_assertion_failed()

void util_assertion_failed ( const char *  filename,
int  line 
)

Handle a failed UTIL_ASSERT().

The library provides a weak implementation that logs and exits; the firmware overrides it to crash with a core dump.

Parameters
filenameSource file name.
lineSource line number.