summaryrefslogtreecommitdiff
path: root/src/compat/attr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat/attr.hpp')
-rw-r--r--src/compat/attr.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compat/attr.hpp b/src/compat/attr.hpp
index 238a5d5..5322a14 100644
--- a/src/compat/attr.hpp
+++ b/src/compat/attr.hpp
@@ -28,4 +28,10 @@ namespace tmwa
#else
# define FALLTHROUGH /* fallthrough */
#endif
+
+#define JOIN(a, b) a##b
+
+#define WITH_VAR(ty, var, expr) \
+ for (bool JOIN(var, _guard) = true; JOIN(var, _guard); ) \
+ for (ty var = expr; JOIN(var, _guard); JOIN(var, _guard) = false)
} // namespace tmwa