This repository has been archived on 2023-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
tcpaste/include/debug.h
Thorsten Schubert 64c89e9274
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone Build encountered an error
Bug fixes
2021-11-08 18:39:10 +01:00

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