summaryrefslogtreecommitdiff
path: root/src/libk/include/assert.h
diff options
context:
space:
mode:
authordzwdz2023-08-24 19:10:35 +0200
committerdzwdz2023-08-24 19:10:35 +0200
commit3e09037780ca95633749be3acd52e817eed7f98c (patch)
tree83bcf5026cd4383809c81c5f38473a6b1e46755e /src/libk/include/assert.h
parent292b2386d766826b15f5ca084d37aa2c485fdda6 (diff)
libc: get most of binutils to compile
Diffstat (limited to 'src/libk/include/assert.h')
-rw-r--r--src/libk/include/assert.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libk/include/assert.h b/src/libk/include/assert.h
index 7520aa9..affe1dc 100644
--- a/src/libk/include/assert.h
+++ b/src/libk/include/assert.h
@@ -1,7 +1,12 @@
#ifdef NDEBUG
-#define assert(stmt) do {} while (0)
+#define assert(stmt) ((void)0)
#else
-#define assert(stmt) do { if (!(stmt)) __badassert(__func__, __FILE__, __LINE__); } while (0)
+#define assert(stmt) (void)((stmt) || (__badassert(__func__, __FILE__, __LINE__),0))
+#endif
+
+#ifdef __SPARSE
+#undef assert
+#define assert(stmt) (0)
#endif
_Noreturn void __badassert(const char *func, const char *file, int line);