]> gcc.gnu.org Git - gcc.git/blob - gcc/assert.h
*** empty log message ***
[gcc.git] / gcc / assert.h
1 /* Allow this file to be included multiple times
2 with different settings of NDEBUG. */
3 #undef assert
4 #undef __assert
5
6 #ifdef NDEBUG
7 #define assert(ignore) ((void) 0)
8 #else
9
10 #ifndef __GNUC__
11
12 #define assert(expression) \
13 ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
14
15 #define __assert(expression, file, lineno) \
16 (printf ("%s:%u: failed assertion\n", file, lineno), \
17 abort (), 0)
18
19 #else
20
21 #ifdef __STDC__
22
23 /* Defined in libgcc.a */
24 extern void __eprintf (const char *, const char *, int, const char *);
25
26 #define assert(expression) \
27 ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))
28
29 #define __assert(expression, file, line) \
30 (__eprintf ("%s:%u: failed assertion `%s'\n", \
31 file, line, expression), 0)
32
33 #else /* no __STDC__; i.e. -traditional. */
34
35 extern void __eprintf (); /* Defined in libgcc.a */
36
37 #define assert(expression) \
38 ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
39
40 #define __assert(expression, file, lineno) \
41 (__eprintf ("%s:%u: failed assertion `%s'\n", \
42 file, lineno, "expression"), 0)
43
44 #endif /* no __STDC__; i.e. -traditional. */
45 #endif /* no __GNU__; i.e., /bin/cc. */
46 #endif
This page took 2.197768 seconds and 6 git commands to generate.