still serv_close bug...
[mit-jos.git] / inc / assert.h
blobaba04dea6ab8e10c1aa9891243caadccde2a012a
1 /* See COPYRIGHT for copyright information. */
3 #ifndef JOS_INC_ASSERT_H
4 #define JOS_INC_ASSERT_H
6 #include <inc/stdio.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__)
14 #define assert(x) \
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 */