summaryrefslogtreecommitdiffhomepage
path: root/compat/macros.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-22 12:54:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:01:53 +0200
commitf50ac3549d6a7f1199fa012e4b03f581bc8d305b (patch)
tree50ff044f1c618119c88544709808f533ed02225e /compat/macros.hpp
parentd61eb905ae3fa161d50821d01ee47915713e89c2 (diff)
core, modules: modernize syntax only
Use more C++17 features where this helps any.
Diffstat (limited to 'compat/macros.hpp')
-rw-r--r--compat/macros.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 564dcc8d..abe89c73 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -64,5 +64,10 @@ constexpr force_inline void static_warn<true>() {}
#define static_warning(cond) \
static_warn<(cond)>(); \
+#define progn(...) (([&] { __VA_ARGS__ })())
+#define prog1(x, ...) (([&] { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })())
+
// end c++-only macros
#endif
+
+#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)