1#pragma once
2
3/*
4 * Assertions and panic
5 *
6 * Unlike assertions from standard library they cannot be
7 * turned off and can be used for input parameters validation.
8 */
9
10#include <stdint.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define pw_assert(condition) \
17 __extension__ \
18 ({ \
19 if (_pw_unlikely( !(condition) )) { \
20 pw_panic("PW assertion failed at %s:%s:%d: " #condition "\n", __FILE__, __func__, __LINE__); \
21 } \
22 })
23
24[[noreturn]]
25void pw_panic(char* fmt, ...);
26
27#ifdef __cplusplus
28}
29#endif