assert.h 357 B

123456789101112131415
  1. /* Minimal freestanding assert.h for ring-3 commands. */
  2. #ifndef LIBC_ASSERT_H
  3. #define LIBC_ASSERT_H
  4. #ifdef NDEBUG
  5. #define assert(expr) ((void)0)
  6. #else
  7. void __assert_fail(const char *expr, const char *file, unsigned int line)
  8. __attribute__((noreturn));
  9. #define assert(expr) \
  10. ((expr) ? (void)0 : __assert_fail(#expr, __FILE__, __LINE__))
  11. #endif
  12. #endif