assert.h 431 B

123456789101112131415161718192021222324
  1. #undef assert
  2. #if __STDC_VERSION__ >= 201112L
  3. #elif defined(__GNUC__)
  4. #define _Noreturn __attribute__((__noreturn__))
  5. #else
  6. #define _Noreturn
  7. #endif
  8. #ifdef NDEBUG
  9. #define assert(x) (void)0
  10. #else
  11. #define assert(x) ((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0))
  12. #endif
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. _Noreturn void __assert_fail (const char *, const char *, int, const char *);
  17. #ifdef __cplusplus
  18. }
  19. #endif