assert.h: assert & assert_msg panic macros
This commit is contained in:
parent
dac4f9de43
commit
89197a0b07
1 changed files with 15 additions and 0 deletions
15
kern/libkern/assert.h
Normal file
15
kern/libkern/assert.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <panic.h>
|
||||||
|
|
||||||
|
#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)
|
Loading…
Add table
Reference in a new issue