home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / mntinc16 / assert.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  879 b   |  45 lines

  1. /*
  2.  * assert.h
  3.  *    sec 4.2 ansi draft
  4.  */
  5.  
  6. /* Allow this file to be included multiple times
  7.    with different settings of NDEBUG.  */
  8. #undef assert
  9. #ifndef _COMPILER_H
  10. #include <compiler.h>
  11. #endif
  12.  
  13. __EXTERN void __eprintf __PROTO((const char *, const char *, const long,
  14.                 const char *));
  15. __EXTERN void abort __PROTO((void));
  16.  
  17. #ifndef __FAILED
  18. #define __FAILED "assertion `%s' failed at line '%ld' of file %s\n"
  19. #endif
  20.  
  21. #ifdef NDEBUG
  22. #define    assert(cond)
  23. #else
  24.  
  25. #ifdef __STDC__
  26. #define assert(cond) \
  27. if(!(cond)) { __eprintf(__FAILED, #cond, (long)__LINE__, __FILE__); abort(); }
  28.  
  29. #else
  30.  
  31. #ifndef __LINE__
  32. #define __LINE__ 0
  33. #endif
  34. #ifndef __FILE__
  35. #define __FILE__ "unknown"
  36. #endif
  37.  
  38. #define assert(cond) \
  39. if(!(cond)) { __eprintf(__FAILED, "cond", (long)__LINE__, __FILE__); abort(); }
  40.  
  41.  
  42. #endif /* __STDC__ */
  43.  
  44. #endif /* NDEBUG */
  45.