You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1KB

  1. /*
  2. assert.h
  3. */
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include "_ansi.h"
  8. #undef assert
  9. #ifdef NDEBUG /* required by ANSI standard */
  10. # define assert(__e) ((void)0)
  11. #else
  12. # define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
  13. __ASSERT_FUNC, #__e))
  14. # ifndef __ASSERT_FUNC
  15. /* Use g++'s demangled names in C++. */
  16. # if defined __cplusplus && defined __GNUC__
  17. # define __ASSERT_FUNC __PRETTY_FUNCTION__
  18. /* C99 requires the use of __func__. */
  19. # elif __STDC_VERSION__ >= 199901L
  20. # define __ASSERT_FUNC __func__
  21. /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
  22. # elif __GNUC__ >= 2
  23. # define __ASSERT_FUNC __FUNCTION__
  24. /* failed to detect __func__ support. */
  25. # else
  26. # define __ASSERT_FUNC ((char *) 0)
  27. # endif
  28. # endif /* !__ASSERT_FUNC */
  29. #endif /* !NDEBUG */
  30. void __assert (const char *, int, const char *)
  31. _ATTRIBUTE ((__noreturn__));
  32. void __assert_func (const char *, int, const char *, const char *)
  33. _ATTRIBUTE ((__noreturn__));
  34. #if __STDC_VERSION__ >= 201112L && !defined __cplusplus
  35. # define static_assert _Static_assert
  36. #endif
  37. #ifdef __cplusplus
  38. }
  39. #endif