diff options
author | Jakob Kaivo <jkk@ung.org> | 2024-01-30 13:00:19 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2024-01-30 13:00:19 -0500 |
commit | 620f2dca70f68748c78e9caa634606a56e8b57b4 (patch) | |
tree | f42a3c066423724fd9a9542f46c16796ecead6e8 /src/assert | |
parent | 162163d2d66381f1d2f9e7ed2f8c51a6686a0c13 (diff) |
include proper standard and safety checks
Diffstat (limited to 'src/assert')
-rw-r--r-- | src/assert/__assert.c | 11 | ||||
-rw-r--r-- | src/assert/assert.c | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/assert/__assert.c b/src/assert/__assert.c index 8e11b756..0a3f95c3 100644 --- a/src/assert/__assert.c +++ b/src/assert/__assert.c @@ -1,10 +1,11 @@ -#if 0 - #include <stdio.h> #include <stdlib.h> +#include "_safety.h" void __assert(const char *expr, const char *file, int line, const char *func) { + SIGNAL_SAFE(0); + if (func) { fprintf(stderr, "Assertion failed: %s (%s:%d:%s())\n", expr, file, line, func); @@ -12,8 +13,10 @@ void __assert(const char *expr, const char *file, int line, const char *func) fprintf(stderr, "Assertion failed: %s (%s:%d)\n", expr, file, line); } + abort(); } - -#endif +/* +STDC(0) +*/ diff --git a/src/assert/assert.c b/src/assert/assert.c index 2a5551a4..65beff36 100644 --- a/src/assert/assert.c +++ b/src/assert/assert.c @@ -1,13 +1,13 @@ #include <stdlib.h> #include "stdlib/_stdlib.h" -_Noreturn void assert(int exp) +void assert() { - (void)exp; __stdlib.constraint_handler("Undefined Behavior: The assert() macro has been suppressed to access an actual function", NULL, 0); abort(); } /* +SIGNAL_SAFE(0) STDC(0) */ |