From e3e8caf61bbc22c3b278ce8bd36501b73806d524 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Mar 2019 04:28:00 +0100 Subject: actually expand __COUNTER__ --- compat/macros1.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compat') diff --git a/compat/macros1.h b/compat/macros1.h index 5e3129d5..f6b05f0f 100644 --- a/compat/macros1.h +++ b/compat/macros1.h @@ -42,6 +42,7 @@ #ifdef __cplusplus # define progn(...) ([&]() -> decltype(auto) { __VA_ARGS__ }()) +# define eval_once2(expr, ctr) eval_once3(expr, ctr) +# define eval_once3(expr, ctr) ([&] { [[maybe_unused]] static const char init_ ## ctr = ((void)(expr), 0); }()) # define eval_once(expr) eval_once2(expr, __COUNTER__) -# define eval_once2(expr, ctr) ([&] { [[maybe_unused]] static auto init ## ctr = (((void)(expr)), 0); }()) #endif -- cgit v1.2.3