zassert.h 686 B

123456789101112131415161718192021222324252627
  1. /*
  2. * $Id: zassert.h,v 1.2 2004/12/03 18:01:04 ajs Exp $
  3. */
  4. #ifndef _QUAGGA_ASSERT_H
  5. #define _QUAGGA_ASSERT_H
  6. extern void _zlog_assert_failed (const char *assertion, const char *file,
  7. unsigned int line, const char *function)
  8. __attribute__ ((noreturn));
  9. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  10. #define __ASSERT_FUNCTION __func__
  11. #elif defined(__GNUC__)
  12. #define __ASSERT_FUNCTION __FUNCTION__
  13. #else
  14. #define __ASSERT_FUNCTION NULL
  15. #endif
  16. #define zassert(EX) ((void)((EX) ? 0 : \
  17. (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
  18. __ASSERT_FUNCTION), 0)))
  19. #undef assert
  20. #define assert(EX) zassert(EX)
  21. #endif /* _QUAGGA_ASSERT_H */