matos/userspace/assert.h

20 lines
1.3 KiB
C
Raw Permalink Normal View History

2021-11-05 23:02:23 +01:00
#pragma once
#include "libc.h"
#define assert(p) \
do { \
if (!(p)) { \
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
2024-01-29 21:47:24 +01:00
_exit(-1); \
2021-11-05 23:02:23 +01:00
} \
} while (0)
#define assertmsg(p, ...) \
do { \
if (!(p)) { \
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
printf(__VA_ARGS__); \
2024-01-29 21:47:24 +01:00
_exit(-1); \
2021-11-05 23:02:23 +01:00
} \
} while (0)