]> granicus.if.org Git - graphviz/commitdiff
Convert top-level empty action blocks to a trivial action, since empty blocks
authorerg <devnull@localhost>
Tue, 14 Dec 2010 20:26:16 +0000 (20:26 +0000)
committererg <devnull@localhost>
Tue, 14 Dec 2010 20:26:16 +0000 (20:26 +0000)
should not be the same as missing blocks.

lib/gvpr/compile.c

index a85911fb01007b6383d25013c3d3cb99f0f04f2c..e882c9bfdde7849b16cc170714ff8f9e6682bb69 100644 (file)
@@ -2282,6 +2282,16 @@ static case_stmt *mkStmts(Expr_t * prog, char *src, case_info * sp,
            cs[i].action = compile(prog, src, sp->action, sp->astart,
                                   sfstruse(tmps), 0, INTEGER);
            if (getErrorErrors()) break;
+           /* If no error but no compiled action, the input action must
+            * have been essentially an empty block, which should be
+            * considered different from a missing block. So, compile a
+            * trivial block.
+            */
+           if (!cs[i].action) {
+               sfprintf(tmps, "%s__a%d", lbl, i);
+               cs[i].action = compile(prog, src, "1", sp->astart,
+                                  sfstruse(tmps), 0, INTEGER);
+           }
        }
        sp = sp->next;
     }