aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/assert.h')
-rw-r--r--include/assert.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/assert.h b/include/assert.h
new file mode 100644
index 0000000..aac81d7
--- /dev/null
+++ b/include/assert.h
@@ -0,0 +1,16 @@
+#ifndef __DUCC_BUILTIN___ASSERT_H__
+#define __DUCC_BUILTIN___ASSERT_H__
+
+#ifdef NDEBUG
+#define assert(x) ((void)0)
+#else
+#define assert(x) \
+ do { \
+ if (!(x)) { \
+ fprintf(stderr, "%s:%d: assertion failed.\n", __FILE__, __LINE__); \
+ abort(); \
+ } \
+ } while (0)
+#endif
+
+#endif