Describe what check() and expect() are
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-01-14 10:59:30 +01:00
parent eb35abfa52
commit da805eec83
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -7,6 +7,7 @@
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x) #define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
#endif #endif
// Like check(), but with a custom error message.
#define expect(expr, message) \ #define expect(expr, message) \
do { \ do { \
if (!(expr)) [[unlikely]] \ if (!(expr)) [[unlikely]] \
@ -15,6 +16,7 @@
} \ } \
} while (0) } while (0)
// Like assert(), but always enabled.
#define check(expr) \ #define check(expr) \
do { \ do { \
if (!(expr)) [[unlikely]] \ if (!(expr)) [[unlikely]] \