ASSERT - Assert#

Enhanced assert/error checking module with detailed logging.

This implementation provides comprehensive assert handling with:

  • File name, line number, and expression logging

  • Debug session detection and breakpoint triggering

  • Conditional debug asserts via SL_LOG_DEBUG_ASSERT_ENABLE flag

Assert Macros:

  • SL_LOG_CRASH_ASSERT: Always active, triggers assert handler

  • SL_LOG_DEBUG_ASSERT: Active only when SL_LOG_DEBUG_ASSERT_ENABLE is defined

  • assert: Core assert implementation with detailed logging

Macros#

#define

Core assert implementation with file, line, and expression logging.

#define

Crash assert - always enabled regardless of SL_LOG_DEBUG_ASSERT_ENABLE configuration.

#define

Debug assert - enabled only when SL_LOG_DEBUG_ASSERT_ENABLE is defined.

Macro Definition Documentation#

debug_assert#

#define debug_assert
Value:
((__e) \
? (void)0 \
: sli_log_assert_implementation( \
__FILE__ ":" SL_STRINGIFY(__LINE__) " - Assertion failed: " #__e) \
)

Core assert implementation with file, line, and expression logging.

If the condition is false, constructs a detailed error string and passes it to sli_assert_implementation for handling.


SL_LOG_CRASH_ASSERT#

#define SL_LOG_CRASH_ASSERT
Value:
(condition)

Crash assert - always enabled regardless of SL_LOG_DEBUG_ASSERT_ENABLE configuration.


SL_LOG_DEBUG_ASSERT#

#define SL_LOG_DEBUG_ASSERT
Value:
(condition)

Debug assert - enabled only when SL_LOG_DEBUG_ASSERT_ENABLE is defined.

In debug builds, maps to SL_LOG_CRASH_ASSERT for full error handling. In release builds, this macro is disabled (no-op) to save code space.