From 20645dbb5ca19015d100f33277c7fcf60bd4bf93 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 4 Oct 2021 19:28:17 +0200 Subject: Added c_autodefer() macro (again). Depressed warning with c_no_compare(). --- include/stc/ccommon.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index c9ca7ad0..e3ccfffd 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -94,7 +94,7 @@ #define c_default_compare(x, y) c_less_compare(c_default_less, x, y) #define c_default_less(x, y) (*(x) < *(y)) -#define c_no_compare(x, y) (assert(!"c_no_compare() called"), 0) +#define c_no_compare(x, y) (assert(!"c_no_compare() called"), (x)==(y)) #define c_less_compare(less, x, y) (less(y, x) - less(x, y)) #define c_default_equals(x, y) (*(x) == *(y)) @@ -138,6 +138,7 @@ STC_API uint64_t c_default_hash(const void *key, size_t len); #define c_autoscope(init, ...) for (int _c_ii = (init, 0); !_c_ii; ++_c_ii, __VA_ARGS__) #define c_autovar(declvar, ...) for (declvar, *_c_ii = NULL; !_c_ii; ++_c_ii, __VA_ARGS__) +#define c_autodefer(...) for (int _c_ii = 0; !_c_ii; ++_c_ii, __VA_ARGS__) #define c_exitauto continue #define c_auto(...) c_MACRO_OVERLOAD(c_auto, __VA_ARGS__) -- cgit v1.2.3