diff --git a/kern/libkern/assert.h b/kern/libkern/assert.h new file mode 100644 index 0000000..7cb7a27 --- /dev/null +++ b/kern/libkern/assert.h @@ -0,0 +1,15 @@ +#include + +#define assert(cond) \ + do { \ + if (!(cond)) { \ + PANIC("Assertion failed: %s\n", #cond); \ + } \ + } while (0) + +#define assert_msg(cond, fmt, ...) \ + do { \ + if (!(cond)) { \ + PANIC("Assertion failed: %s: " fmt, #cond, ##__VA_ARGS__); \ + } \ + } while (0)