File: assert.h

package info (click to toggle)
egcs1.0 1.0.3a-2
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 60,976 kB
  • ctags: 76,848
  • sloc: ansic: 581,742; cpp: 92,408; sh: 10,598; asm: 9,507; yacc: 8,693; lisp: 7,087; makefile: 6,950; exp: 2,610; sed: 497; objc: 482; fortran: 405; awk: 223; pascal: 133; csh: 106; ml: 75
file content (54 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* Allow this file to be included multiple times
   with different settings of NDEBUG.  */
#undef assert
#undef __assert

#ifdef NDEBUG
#define assert(ignore) ((void) 0)
#else

#ifndef __GNUC__

#define assert(expression)  \
  ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))

#define __assert(expression, file, lineno)  \
  (printf ("%s:%u: failed assertion\n", file, lineno),	\
   abort (), 0)

#else

#if defined(__STDC__) || defined (__cplusplus)

/* Defined in libgcc.a */
#ifdef __cplusplus
extern "C" {
extern void __eprintf (const char *, const char *, unsigned, const char *)
    __attribute__ ((noreturn));
}
#else
extern void __eprintf (const char *, const char *, unsigned, const char *)
    __attribute__ ((noreturn));
#endif

#define assert(expression)  \
  ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))

#define __assert(expression, file, line)  \
  (__eprintf ("%s:%u: failed assertion `%s'\n",		\
	      file, line, expression), 0)

#else /* no __STDC__ and not C++; i.e. -traditional.  */

extern void __eprintf () __attribute__ ((noreturn)); /* Defined in libgcc.a */

#define assert(expression)  \
  ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))

#define __assert(expression, file, lineno)  \
  (__eprintf ("%s:%u: failed assertion `%s'\n",		\
	      file, lineno, "expression"), 0)

#endif /* no __STDC__ and not C++; i.e. -traditional.  */
#endif /* no __GNU__; i.e., /bin/cc.  */
#endif