chiark / gitweb /
utils/control.h: Allow statement block without terminating semicolon.
[mLib] / utils / control.h
index 77d985a3d8f2f5dec0eef86b43a1a064a36323c5..8be1cf1bdfbd1c0ebe9c4bb3294fc69af2dcd283 100644 (file)
@@ -64,7 +64,7 @@
  * will then be to the statement following the containing action sequence and
  * its body.
  */
-#define MC_ACT(stmt)   if (1) stmt else
+#define MC_ACT(stmt)   if (1) { stmt; } else
 #define MC_PASS                MC_ACT(;)
 
 
  * action in its own right, in place of @MC_ACT@.
  */
 #define MC_LABEL(tag)  MCTRL__LABEL(tag):
-#define MC_GOTO(tag)   MC_ACT({ goto MCTRL__LABEL(tag); })
+#define MC_GOTO(tag)   MC_ACT(goto MCTRL__LABEL(tag))
 
 /* @BEFORE(tag, stmt_0) stmt_1@
  *
  * Execute @stmt_0@ and then @stmt_1@.
  */
 #define BEFORE(tag, stmt)                                              \
-                       MC_ACT({ stmt MC_GOTO(tag##__body); })          \
+                       MC_ACT(stmt; MC_GOTO(tag##__body))              \
   MC_LABEL(tag##__body)
 
 /* @AFTER(tag, stmt_0) stmt_1@
  * statements behave as one would expect from their context.
  */
 #define WRAP(tag, before, onend, onbreak)                              \
-                       MC_ACT({ before MC_GOTO(tag##__body); })        \
+                       MC_ACT(before; MC_GOTO(tag##__body))            \
   MC_LABEL(tag##__end) MC_ACT(onend)                                   \
   MC_LABEL(tag##__brk) MC_ACT(onbreak)                                 \
                        for (;;)                                        \
 #  define DECL(tag, decl)                                              \
                        for (decl;;)                                    \
                          MC_GOTO(tag##__body)                          \
-  MC_LABEL(tag##__end)   MC_ACT({ break; })                            \
+  MC_LABEL(tag##__end)   MC_ACT(break)                                 \
                          for (;;)                                      \
                            MC_GOTO(tag##__end)                         \
   MC_LABEL(tag##__body)