summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-22 04:28:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-28 08:58:40 +0100
commite3e8caf61bbc22c3b278ce8bd36501b73806d524 (patch)
treeac24885c76082486e1fbd12ef5f525ea5d566d24 /compat
parent01b80e4f56cc9f5120a9a34690e6f593006e5585 (diff)
actually expand __COUNTER__
Diffstat (limited to 'compat')
-rw-r--r--compat/macros1.h3
1 files changed, 2 insertions, 1 deletions
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