23 lines
1,012 B
C
23 lines
1,012 B
C
#pragma once
|
|
|
|
#include "log.h"
|
|
#include "macros.h"
|
|
|
|
#define xassert(x) \
|
|
do { \
|
|
PUSH_IGNORE("-Wtautological-compare") \
|
|
if (unlikely(!(x))) { \
|
|
LOG_ERROR("assertion failed: '%s'", #x); \
|
|
} \
|
|
POP_IGNORE \
|
|
} while (0)
|
|
|
|
#ifndef static_assert
|
|
#if __STDC_VERSION__ >= 201112L
|
|
#define static_assert(x, msg) _Static_assert((x), msg)
|
|
#elif HAS_EXTENSION(c_static_assert)
|
|
#define static_assert(x, msg) __extension__ _Static_assert((x), msg)
|
|
#else
|
|
#define static_assert(x, msg)
|
|
#endif
|
|
#endif
|