From fe52cb6ea9355761b5025bbdeef834884d9e255c Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 14 Dec 2019 11:53:55 +0100 Subject: [PATCH] hassert macro --- hyper.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hyper.h b/hyper.h index 25bb4075..20740c2c 100644 --- a/hyper.h +++ b/hyper.h @@ -763,6 +763,13 @@ static const color_t NOCOLOR = 0; } +// assert macro +#ifdef NDEBUG +#define hassert(condition) if(!condition) __builtin_unreachable() +#else +#define hassert(condition) if(condition) println(hlog, __FILE__, ":", __LINE__, ":", __func__, ": assertion failed: ", condition) +#endif + #define IS(z) = z #include "autohdr.h" #undef IS