summaryrefslogtreecommitdiff
path: root/include/assert.h
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-14 04:16:35 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-14 04:16:35 +0000
commit64bc6412188b141c010ac3b8e813b837dd991e80 (patch)
treeffa12b79ea4b13191754f54b872eb1a4f9e3a04b /include/assert.h
Initial revision
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 */