ciabatta/inc/assert.h

27 lines
1021 B
C
Raw Normal View History

2022-06-02 23:41:48 +00:00
#pragma once
#include "_compiler.h"
2022-06-07 06:02:23 +00:00
#include "_macros.h"
2022-06-02 05:18:26 +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)) { \
_assert_error( \
#condition, \
_compiler_curfunc, \
__FILE__, \
_str(__LINE__)); \
2022-06-02 05:18:26 +00:00
} \
} while(0)
#endif