sift_assert.h 708 B

123456789101112131415161718
  1. #ifndef __SIFT_ASSERT_H
  2. #define __SIFT_ASSERT_H
  3. #include <cassert>
  4. // Define our own version of assert() with a handler that can be overridden through weak linkage
  5. extern void __sift_assert_fail(__const char *__assertion, __const char *__file,
  6. unsigned int __line, __const char *__function)
  7. __THROW __attribute__ ((__noreturn__));
  8. # define sift_assert(expr) \
  9. ((expr) \
  10. ? __ASSERT_VOID_CAST (0) \
  11. : __sift_assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
  12. #endif // __SIFT_ASSERT_H