#ifndef __ASSERT_H
#define __ASSERT_H
#include <util.h>
#ifdef DEBUG
void _fail(
const char* str,
const char* file,
unsigned int line,
const char* function
) NORETURN;
#define fail(s) _fail(s, __FILE__, __LINE__, __func__)
void _assert_fail(
const char* assertion,
const char* file,
unsigned int line,
const char* function
) NORETURN;
#define assert(expr) \
if(!(expr)) _assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__)
#else
#define fail(s) halt()
#define assert(expr)
#endif
#define compile_assert(name, expr) \
typedef int __assert_failed_##name[(expr) ? 1 : -1];
#endif