Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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