123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifdef _ASSERT_H
- # undef _ASSERT_H
- # undef assert
- # undef __ASSERT_VOID_CAST
- # ifdef __USE_GNU
- # undef assert_perror
- # endif
- #endif
- #define _ASSERT_H 1
- #include <features.h>
- #if defined __cplusplus && __GNUC_PREREQ (2,95)
- # define __ASSERT_VOID_CAST static_cast<void>
- #else
- # define __ASSERT_VOID_CAST (void)
- #endif
- #ifdef NDEBUG
- # define assert(expr) (__ASSERT_VOID_CAST (0))
- # ifdef __USE_GNU
- # define assert_perror(errnum) (__ASSERT_VOID_CAST (0))
- # endif
- #else
- __BEGIN_DECLS
- extern void __assert_fail (const char *__assertion, const char *__file,
- unsigned int __line, const char *__function)
- __THROW __attribute__ ((__noreturn__));
- extern void __assert_perror_fail (int __errnum, const char *__file,
- unsigned int __line, const char *__function)
- __THROW __attribute__ ((__noreturn__));
- extern void __assert (const char *__assertion, const char *__file, int __line)
- __THROW __attribute__ ((__noreturn__));
- __END_DECLS
- # define assert(expr) \
- ((expr) \
- ? __ASSERT_VOID_CAST (0) \
- : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
- # ifdef __USE_GNU
- # define assert_perror(errnum) \
- (!(errnum) \
- ? __ASSERT_VOID_CAST (0) \
- : __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION))
- # endif
- # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
- # define __ASSERT_FUNCTION __PRETTY_FUNCTION__
- # else
- # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
- # define __ASSERT_FUNCTION __func__
- # else
- # define __ASSERT_FUNCTION ((const char *) 0)
- # endif
- # endif
- #endif
- #if defined __USE_ISOC11 && !defined __cplusplus
- # undef static_assert
- # define static_assert _Static_assert
- #endif
|