ciabatta/inc/assert.h

19 lines
662 B
C
Raw Normal View History

2022-06-02 05:18:26 +00:00
2022-06-02 23:41:48 +00:00
#pragma once
2022-06-02 05:18:26 +00:00
2022-06-02 23:41:48 +00:00
#include "_macros.h"
2022-06-02 05:18:26 +00:00
2022-06-02 23:41:48 +00:00
extern void _assert_error(char *cond, char const *func, char const *file, char const *line);
2022-06-02 05:18:26 +00:00
#if defined(NDEBUG)
#define assert(ignore) ((void)0)
#else
#define _static_assert _Static_assert
#define assert(condition) \
do { \
if(!(condition)) { \
2022-06-02 23:41:48 +00:00
_assert_error(#condition, _func, __FILE__, _str(__LINE__)); \
2022-06-02 05:18:26 +00:00
} \
} while(0)
#endif