Skip to content

File syn_assert.h

FileList > src > syntropic > util > syn_assert.h

Go to the source code of this file

Configurable assertion macro for SyntropicOS. More...

  • #include "../common/syn_compiler.h"

Public Functions

Type Name
SYN_NORETURN void syn_assert_failed (const char * file, int line)
Called when an assertion fails.

Macros

Type Name
define SYN_ASSERT (expr) /* multi line expression */
Assert that expr is true. If false, callsyn_assert_failed() .

Detailed Description

SYN_ASSERT(expr) evaluates expr and, if false, calls syn_assert_failed() with the file name and line number. The user can override syn_assert_failed() to implement custom behavior (e.g., log to UART, blink an LED, enter debugger).

Define SYN_DISABLE_ASSERT before including this header (or in syn_config.h) to compile out all assertions for release builds.

Public Functions Documentation

function syn_assert_failed

Called when an assertion fails.

SYN_NORETURN void syn_assert_failed (
    const char * file,
    int line
) 

This function is declared weak so you can provide your own implementation. The default (in syn_port_stubs.c) enters an infinite loop.

Parameters:

  • file Source file name where the assertion failed.
  • line Line number where the assertion failed.

Macro Definition Documentation

define SYN_ASSERT

Assert that expr is true. If false, callsyn_assert_failed() .

#define SYN_ASSERT (
    expr
) `/* multi line expression */`



The documentation for this class was generated from the following file src/syntropic/util/syn_assert.h