assert.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. __attribute__((__noreturn__)) void osiPanic(void);
  13. /*+\NEW\zhuwangbin\2020.4.2\Ìí¼ÓAT*exinfoÖ¸Áî*/
  14. extern void osiPanicInfoFuncLineSet(const char *func, int line);
  15. # define assert(__e) do {if(__e) {((void)0);} else {osiPanicInfoFuncLineSet(__FUNCTION__,__LINE__);osiPanic();}}while(0)
  16. /*-\NEW\zhuwangbin\2020.4.2\Ìí¼ÓAT*exinfoÖ¸Áî*/
  17. # ifndef __ASSERT_FUNC
  18. /* Use g++'s demangled names in C++. */
  19. # if defined __cplusplus && defined __GNUC__
  20. # define __ASSERT_FUNC __PRETTY_FUNCTION__
  21. /* C99 requires the use of __func__. */
  22. # elif __STDC_VERSION__ >= 199901L
  23. # define __ASSERT_FUNC __func__
  24. /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
  25. # elif __GNUC__ >= 2
  26. # define __ASSERT_FUNC __FUNCTION__
  27. /* failed to detect __func__ support. */
  28. # else
  29. # define __ASSERT_FUNC ((char *) 0)
  30. # endif
  31. # endif /* !__ASSERT_FUNC */
  32. #endif /* !NDEBUG */
  33. void _EXFUN(__assert, (const char *, int, const char *)
  34. _ATTRIBUTE ((__noreturn__)));
  35. void _EXFUN(__assert_func, (const char *, int, const char *, const char *)
  36. _ATTRIBUTE ((__noreturn__)));
  37. #if __STDC_VERSION__ >= 201112L && !defined __cplusplus
  38. # define static_assert _Static_assert
  39. #endif
  40. #ifdef __cplusplus
  41. }
  42. #endif