assert.h 563 B

1234567891011121314151617181920212223
  1. /*
  2. * assert.h - diagnostics
  3. *
  4. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  5. * See the copyright notice in the ACK home directory, in the file "Copyright".
  6. */
  7. /* $Id$ */
  8. void __bad_assertion(const char *_mess);
  9. #undef assert
  10. #define __str(x) # x
  11. #define __xstr(x) __str(x)
  12. #if defined(NDEBUG)
  13. #define assert(ignore) ((void)0)
  14. #else
  15. #define assert(expr) ((expr)? (void)0 : \
  16. __bad_assertion("Assertion \"" #expr \
  17. "\" failed, file " __xstr(__FILE__) \
  18. ", line " __xstr(__LINE__) "\n"))
  19. #endif /* NDEBUG */