assert.h: assert & assert_msg panic macros

This commit is contained in:
Imbus 2025-09-06 00:13:24 +02:00
parent dac4f9de43
commit 89197a0b07

15
kern/libkern/assert.h Normal file
View 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)