/* assert.h: Debug assertions. */

#ifndef _ASSERT_H
#define _ASSERT_H

#include <bits/attrs.h>

#ifdef __cplusplus
extern "C"
{
#endif

    __noreturn void __assertion_failed(const char* file, int line, const char* function, const char* expr);

#ifdef __cplusplus
}
#endif

#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define static_assert _Static_assert
#endif

#ifdef NDEBUG
#define assert(expr)
#else
#define assert(expr) ((expr) ? (void)0 : __assertion_failed(__FILE__, __LINE__, __func__, #expr))
#endif

#ifdef _LUNA_SOURCE
#define release_assert(expr) ((expr) ? (void)0 : __assertion_failed(__FILE__, __LINE__, __func__, #expr))
#endif

#endif