summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/log.h b/src/log.h
index d954684..64d0d2e 100644
--- a/src/log.h
+++ b/src/log.h
@@ -53,4 +53,27 @@ void log_output(log_level level, const char* message, ...);
#define TRACE(message, ...) log_output(LOG_LEVEL_TRACE, message, ##__VA_ARGS__)
#else
#define TRACE(message, ...)
-#endif \ No newline at end of file
+#endif
+
+// TODO: Move this to an asserts file
+
+void report_assertion_failure(const char *expression, const char *message, const char *file,
+ int line);
+
+#define CASSERT(expr) \
+ { \
+ if (expr) { \
+ } else { \
+ report_assertion_failure(#expr, "", __FILE__, __LINE__); \
+ __builtin_trap(); \
+ } \
+ }
+
+#define CASSERT_MSG(expr, msg) \
+ { \
+ if (expr) { \
+ } else { \
+ report_assertion_failure(#expr, msg, __FILE__, __LINE__); \
+ __builtin_trap(); \
+ } \
+ } \ No newline at end of file