ciabatta/code/assert.c

25 lines
460 B
C
Raw Normal View History

2022-06-02 05:18:26 +00:00
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
2022-06-02 05:18:26 +00:00
#include <_compiler.h>
#include <_os.h>
2022-06-02 05:18:26 +00:00
// TODO: use abort() to break
2022-06-02 05:18:26 +00:00
extern void _assert_error(
char *cond,
char const *func,
char const *file,
char const *line
) {
printf("Assertion failed: %s\n", cond);
if(*func != 0) {
printf("\tFunction: %s\n", func);
2022-06-02 05:18:26 +00:00
}
printf("\tFile: %s\n", file);
printf("\tLine: %s\n", line);
2022-06-07 06:02:23 +00:00
abort();
}