1 /*
2 assert.h
3 */
4 #ifndef ASSERT_H
5 #define ASSERT_H
6
7 #if DEBUG
8
9 #define INIT_ASSERT static char *assert_file= __FILE__;
10
11 void bad_assertion(char *file, int line, char *what);
12 void bad_compare(char *file, int line, int lhs, char *what, int rhs);
13
14 #define assert(x) (!(x) ? bad_assertion(assert_file, __LINE__, #x) \
15 : (void) 0)
16 #define compare(a,t,b) (!((a) t (b)) ? bad_compare(assert_file, __LINE__, \
17 (a), #a " " #t " " #b, (b)) : (void) 0)
18 #else /* !DEBUG */
19
20 #define INIT_ASSERT /* nothing */
21
22 #define assert(x) (void)0
23 #define compare(a,t,b) (void)0
24
25 #endif /* !DEBUG */
26
27 #endif /* ASSERT_H */
28
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.