commit 0ddc858d7d576967bf7596b445ef7f1b19bb7e3d
parent 4d0eb7b766c9805598efcc12bdc43cc1af480aca
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 16 Feb 2017 15:31:53 +0100
[libc] Add implementation of assert()
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/libc/src/assert.c b/libc/src/assert.c
@@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+void __assert(int status, char *exp, char *file, long line)
+{
+ if (status)
+ return;
+ fprintf(stderr, "%s:%ld: assertion failed '%s'\n", file, line, exp);
+ abort();
+}