PatchworkOS
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1
#ifndef _ASSERT_H
2
#define _ASSERT_H 1
3
4
#ifdef __cplusplus
5
extern
"C"
6
{
7
#endif
8
9
#include "
_internal/config.h
"
10
11
_PUBLIC
void
_assert_99
(
const
char
*
const
,
const
char
*
const
,
const
char
*
const
);
12
_PUBLIC
void
_assert_89
(
const
char
*
const
);
13
14
/* If NDEBUG is set, assert() is a null operation. */
15
#undef assert
16
17
#define _SYMBOL2STRING(x) #x
18
#define _VALUE2STRING(x) _SYMBOL2STRING(x)
19
20
// clang-format off
21
#ifdef NDEBUG
22
#define assert(ignore) ((void)0)
23
#else
24
#if __STDC_VERSION__ >= 199901L
25
#define assert(expression) \
26
((expression) ? (void)0 \
27
: _assert_99("Assertion failed: " #expression, __func__, __FILE__"-"_VALUE2STRING(__LINE__)))
28
#else
29
#define assert(expression) ((expression) ? (void)0 : _assert_89("Assertion failed: " #expression " file " __FILE__ "."))
30
#endif
31
#endif
32
// clang-format on
33
34
#if __STDC_VERSION__ >= 201112L
35
#define static_assert _Static_assert
36
#endif
37
38
#ifdef __cplusplus
39
}
40
#endif
41
42
#endif
_assert_89
_PUBLIC void _assert_89(const char *const)
Definition
assert.c:23
_assert_99
_PUBLIC void _assert_99(const char *const, const char *const, const char *const)
Definition
assert.c:11
config.h
_PUBLIC
#define _PUBLIC
Definition
config.h:41
include
libstd
assert.h
Generated by
1.9.8