2021-07-17 05:59:32 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdnoreturn.h>
|
|
|
|
|
|
|
|
// Utilities used by RefC code.
|
|
|
|
|
|
|
|
// Crash is the condition is false.
|
2022-09-21 13:13:15 +03:00
|
|
|
#define IDRIS2_REFC_VERIFY(cond, ...) \
|
|
|
|
do { \
|
|
|
|
if (!(cond)) { \
|
|
|
|
idris2_refc_verify_failed(__FILE__, __LINE__, #cond, __VA_ARGS__); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-07-17 05:59:32 +03:00
|
|
|
|
|
|
|
// Used by `IDRIS2_REFC_VERIFY`, do not use directly.
|
2022-09-21 13:13:15 +03:00
|
|
|
noreturn void idris2_refc_verify_failed(const char *file, int line,
|
|
|
|
const char *cond, const char *fmt, ...)
|
2021-07-17 05:59:32 +03:00
|
|
|
#if defined(__clang__) || defined(__GNUC__)
|
2022-09-21 13:13:15 +03:00
|
|
|
__attribute__((format(printf, 4, 5)))
|
2021-07-17 05:59:32 +03:00
|
|
|
#endif
|
2022-09-21 13:13:15 +03:00
|
|
|
;
|