• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <features.h>
2 
3 #undef assert
4 #ifndef MUSL_ASSERT_H
5 #define MUSL_ASSERT_H
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 typedef enum Assert_Status {
11     ASSERT_ABORT,
12     ASSERT_RETRY,
13     ASSERT_IGNORE
14 }Assert_Status;
15 
16 typedef struct AssertFailureInfo {
17     char *expression;
18     char *file;
19     char *function;
20     int line;
21 }AssertFailureInfo;
22 
23 typedef Assert_Status(*assert_call)(AssertFailureInfo assert_fail);
24 void set_assert_callback(assert_call cb);
25 
26 #ifdef __cplusplus
27 }
28 #endif
29 #endif
30 
31 #ifdef NDEBUG
32 #define	assert(x) (void)0
33 #else
34 #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
35 #endif
36 
37 #if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
38 #define static_assert _Static_assert
39 #endif
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 void __assert_fail (const char *, const char *, int, const char *);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50