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