Zephyr Project API
4.5.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
__assert.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011-2014 Wind River Systems, Inc.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_SYS___ASSERT_H_
8
#define ZEPHYR_INCLUDE_SYS___ASSERT_H_
9
10
#include <
zephyr/sys/zassert.h
>
11
12
#if CONFIG_ASSERT_MODULE_DEFAULT_LEVEL > ZASSERT_LEVEL_OFF
13
14
15
/* @cond INTERNAL_HIDDEN */
16
#define ZASSERT_IMPL_M(_module, _test, ...) \
17
ZASSERT_IMPL_LEVEL(ZASSERT_IMPL_MODULE_LEVEL(_module), (_test), ##__VA_ARGS__)
28
#define __ASSERT(test, ...) ZASSERT_IMPL_M(DEFAULT, test, ##__VA_ARGS__)
29
37
#define __ASSERT_NO_MSG(test) ZASSERT_IMPL_M(DEFAULT, test)
38
48
#define __ASSERT_PRINT(fmt, ...) \
49
do { \
50
if (CONFIG_ASSERT_MODULE_DEFAULT_LEVEL >= ZASSERT_LEVEL_VERBOSE) { \
51
zassert_print(fmt, ##__VA_ARGS__); \
52
} \
53
} while (false)
54
64
#define __ASSERT_MSG_INFO(fmt, ...) __ASSERT_PRINT("\t" fmt "\n", ##__VA_ARGS__)
65
74
#define __ASSERT_LOC(test) \
75
__ASSERT_PRINT("ASSERTION FAIL [%s] @ %s:%d\n", Z_STRINGIFY(test), __FILE__, __LINE__)
76
82
#define __ASSERT_POST_ACTION() zassert_post_action(__FILE__, __LINE__)
83
97
#define __ASSERT_EVAL(expr1, expr2, test, fmt, ...) \
98
do { \
99
expr2; \
100
__ASSERT(test, fmt, ##__VA_ARGS__); \
101
} while (false)
102
103
#else
/* CONFIG_ASSERT_MODULE_DEFAULT_LEVEL > ZASSERT_LEVEL_OFF */
104
105
#define __ASSERT(test, ...) ((void)0)
106
#define __ASSERT_NO_MSG(test) ((void)0)
107
#define __ASSERT_PRINT(fmt, ...) ((void)0)
108
#define __ASSERT_MSG_INFO(fmt, ...) ((void)0)
109
#define __ASSERT_LOC(test) ((void)0)
110
#define __ASSERT_POST_ACTION() ((void)0)
111
#define __ASSERT_EVAL(expr1, expr2, test, fmt, ...) expr1
112
113
#endif
/* CONFIG_ASSERT_MODULE_DEFAULT_LEVEL >= 1 */
114
/* @endcond */
115
#endif
/* ZEPHYR_INCLUDE_SYS___ASSERT_H_ */
zassert.h
Zephyrs assertion framework.
include
zephyr
sys
__assert.h
Generated on
for Zephyr Project API by
1.16.1