Files
ballistic/include/bal_assert.h
Ronald Caesar cb237ebb4b tests: add opcode const emitter test
This only tests if the CONST instruction was emmited correctly by
testing its opcodes and operands. SSA state testing is the next logical
step to complete before I move on to OPCODE_ADD.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-01-31 20:57:56 -04:00

37 lines
2.1 KiB
C

#ifndef BALLISTIC_COMMON_ASSERT_H
#define BALLISTIC_COMMON_ASSERT_H
#include <stddef.h>
void bal_internal_assert_fail(
const char *file, int line, const char *func, const char *expr_str, const char *user_msg, ...);
#define BAL_ASSERT(expression) \
do \
{ \
if (!(expression)) \
{ \
bal_internal_assert_fail(__FILE__, __LINE__, __func__, #expression, NULL, NULL); \
} \
} while (0)
#define BAL_ASSERT_MSG(expression, format, ...) \
do \
{ \
if (!(expression)) \
{ \
bal_internal_assert_fail( \
__FILE__, __LINE__, __func__, #expression, format __VA_OPT__(, ) __VA_ARGS__); \
} \
} while (0)
#define BAL_UNREACHABLE(...) \
bal_internal_assert_fail(__FILE__, \
__LINE__, \
__func__, \
"BAL_UNREACHABLE()", \
"Unreachable code executed", \
##__VA_ARGS__);
#endif // BALLISTIC_COMMON_ASSERT_H