opuntiaOS - an operating system targeting x86 and ARMv7
at master 765 B view raw
1#ifndef _LIBC_ASSERT_H 2#define _LIBC_ASSERT_H 3 4#include <stddef.h> 5#include <stdio.h> 6#include <sys/_structs.h> 7#include <sys/cdefs.h> 8#include <sys/types.h> 9 10__BEGIN_DECLS 11 12#ifndef assert 13#define assert(x) \ 14 if (!(x)) [[unlikely]] { \ 15 printf("Assertion failed: %s, function %s, file %s:%d\n", #x, __func__, __FILE__, __LINE__); \ 16 fflush(stdout); \ 17 abort(); \ 18 } 19#endif // assert 20 21__END_DECLS 22 23#endif // _LIBC_ASSERT_H