Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Files

file  check.h
 Header file for configurable error checking.

Macros

#define CHECKIF(expr)
 Guard error-handling code with a configurable check.

Detailed Description

Macro Definition Documentation

◆ CHECKIF

#define CHECKIF ( expr)

#include <zephyr/sys/check.h>

Value:
if (expr)

Guard error-handling code with a configurable check.

Wrap a condition that evaluates to true when an error is detected, and a statement or block to run when that condition holds.

CHECKIF(dev == NULL) {
return -EINVAL;
}
#define CHECKIF(expr)
Guard error-handling code with a configurable check.
Definition check.h:52
#define EINVAL
Invalid argument.
Definition errno.h:60

The behavior is configurable using Kconfig:

  • CONFIG_RUNTIME_ERROR_CHECKS (default) expands to if (expr)
  • CONFIG_ASSERT_ON_ERRORS asserts, the guarded block is not run
  • CONFIG_NO_RUNTIME_CHECKS checks are omitted at compile time
Parameters
exprError condition expression.