summaryrefslogtreecommitdiffhomepage
path: root/compat/macros1.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-02-28 20:01:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-02-28 20:03:57 +0100
commit87838c82cf6848cf5dc4bc95a82c7b127c4a9d83 (patch)
treeb8a404b2062664c5106dc95725fb03f9519b3579 /compat/macros1.h
parentc6c57b868f418f4566b2d6773e04300a313f41a6 (diff)
compat/macros: move more macros to macros1
Actually `macros.hpp' should become a util header.
Diffstat (limited to 'compat/macros1.h')
-rw-r--r--compat/macros1.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/compat/macros1.h b/compat/macros1.h
index b1137e63..5e3129d5 100644
--- a/compat/macros1.h
+++ b/compat/macros1.h
@@ -39,3 +39,9 @@
#else
# define unreachable() do { __builtin_unreachable(); *(volatile int*)nullptr = 0; } while (0) /* NOLINT(clang-analyzer-core.NullDereference) */
#endif
+
+#ifdef __cplusplus
+# define progn(...) ([&]() -> decltype(auto) { __VA_ARGS__ }())
+# define eval_once(expr) eval_once2(expr, __COUNTER__)
+# define eval_once2(expr, ctr) ([&] { [[maybe_unused]] static auto init ## ctr = (((void)(expr)), 0); }())
+#endif