compiler/assert_hosted.h
2025-02-23 23:46:42 -06:00

17 lines
551 B
C

#pragma once
extern void __assert_fail (const char *__assertion, const char *__file,
unsigned int __line, const char *__function)
__attribute__ ((__noreturn__));
#define __ASSERT_FUNCTION __func__
#define assert(expr) \
({ \
if (!(expr)) \
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
})
#define fail(expr) \
(__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION);)