home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cc-61.0.1 / cc / assert.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  1KB  |  43 lines

  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:%d: failed assertion\n", file, lineno),    \
  17.    abort (), 0)
  18.  
  19. #else
  20. void __eprintf ();        /* Defined in gnulib */
  21.  
  22. #ifdef __STDC__
  23.  
  24. #define assert(expression)  \
  25.   ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))
  26.  
  27. #define __assert(expression, file, line)  \
  28.   (__eprintf ("%s:%d: failed assertion `%s'\n",        \
  29.           file, line, expression), 0)
  30.  
  31. #else /* no __STDC__; i.e. -traditional.  */
  32.  
  33. #define assert(expression)  \
  34.   ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
  35.  
  36. #define __assert(expression, file, lineno)  \
  37.   (__eprintf ("%s:%d: failed assertion `%s'\n",        \
  38.           file, lineno, "expression"), 0)
  39.  
  40. #endif /* no __STDC__; i.e. -traditional.  */
  41. #endif /* no __GNU__; i.e., /bin/cc.  */
  42. #endif
  43.