matos/userspace/assert.h
2024-01-29 22:43:26 +01:00

20 lines
1.3 KiB
C

#pragma once
#include "libc.h"
#define assert(p) \
do { \
if (!(p)) { \
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
_exit(-1); \
} \
} while (0)
#define assertmsg(p, ...) \
do { \
if (!(p)) { \
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
printf(__VA_ARGS__); \
_exit(-1); \
} \
} while (0)