summaryrefslogtreecommitdiff
path: root/include/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/assert.h')
-rw-r--r--include/assert.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/assert.h b/include/assert.h
new file mode 100644
index 000000000..aef6cdf08
--- /dev/null
+++ b/include/assert.h
@@ -0,0 +1,23 @@
+#ifndef __ASSERT_H
+#define __ASSERT_H
+#include <features.h>
+
+/* If NDEBUG is defined, do nothing.
+ If not, and EXPRESSION is zero, print an error message and abort. */
+
+#ifdef NDEBUG
+
+#define assert(expr) ((void) 0)
+
+#else /* Not NDEBUG. */
+
+extern void __assert __P((const char *, const char *, int));
+
+#define assert(expr) \
+ ((void) ((expr) || \
+ (__assert (__STRING(expr), \
+ __FILE__, __LINE__), 0)))
+
+#endif /* NDEBUG. */
+
+#endif /* __ASSERT_H */