1 /* See COPYRIGHT for copyright information. */
3 #ifndef JOS_INC_ASSERT_H
4 #define JOS_INC_ASSERT_H
8 void _warn(const char*, int, const char*, ...);
9 void _panic(const char*, int, const char*, ...) __attribute__((noreturn
));
11 #define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
12 #define panic(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
15 do { if (!(x)) panic("assertion failed: %s", #x); } while (0)
17 // static_assert(x) will generate a compile-time error if 'x' is false.
18 #define static_assert(x) switch (x) case 0: case (x):
20 #endif /* !JOS_INC_ASSERT_H */