1 /* See COPYRIGHT for copyright information. */
3 #ifndef ROS_INC_ASSERT_H
4 #define ROS_INC_ASSERT_H
6 void ( _warn)(const char* NTS, int, const char* NTS, ...);
7 void ( _panic)(const char* NTS, int, const char* NTS, ...)
8 __attribute__((noreturn));
10 #define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
11 #define panic(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
12 #define exhausted(...) _panic(__FILE__, __LINE__, __VA_ARGS__)
16 do { if (!(x)) warn("warning failed: %s", #x); } while (0)
19 do { if (!(x)) panic("assertion failed: %s", #x); } while (0)
21 // static_assert(x) will generate a compile-time error if 'x' is false.
22 #define static_assert(x) switch (x) case 0: case (x):
24 #endif /* !ROS_INC_ASSERT_H */