summaryrefslogtreecommitdiffstats
path: root/src/lisiblestd/assert.h
diff options
context:
space:
mode:
authorClement Sibille <clements+git@lisible.xyz>2024-05-09 08:58:14 +0900
committerClement Sibille <clements+git@lisible.xyz>2024-05-09 08:58:14 +0900
commit5a26e1f481fe85f08093a414e27c1056b85c6715 (patch)
tree20a2384554cfcb437a4b604e02b4a9978507cafc /src/lisiblestd/assert.h
Initial commit
Diffstat (limited to '')
-rw-r--r--src/lisiblestd/assert.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lisiblestd/assert.h b/src/lisiblestd/assert.h
new file mode 100644
index 0000000..9bd7514
--- /dev/null
+++ b/src/lisiblestd/assert.h
@@ -0,0 +1,22 @@
+#ifndef LSTD_ASSERT_H
+#define LSTD_ASSERT_H
+
+#include "log.h"
+
+extern void exit(int);
+
+#define LSTD_ASSERT(expr) \
+ do { \
+ if (!(expr)) { \
+ LOG("Assertion failed:\n\t%s", #expr); \
+ exit(1); \
+ } \
+ } while (0)
+
+#define LSTD_UNIMPLEMENTED() \
+ do { \
+ LOG0("Unimplemented code reached"); \
+ exit(1); \
+ } while (0)
+
+#endif // LSTD_ASSERT_H
Go back to lisible.xyz