shithub: mc

Download patch

ref: 342be478e2d49ac4c33e800a6b076f91f6ba5ed6
parent: c3dc6ac40cf15b3940567eb95804b972afb9b5af
author: Ori Bernstein <[email protected]>
date: Mon Jan 9 19:21:29 EST 2012

Don't insert empty stmt nodes into list.

--- a/parse/gram.y
+++ b/parse/gram.y
@@ -526,12 +526,12 @@
 
 blockbody
         : stmt
-            {
-                $$ = mkblock(line, mkstab());
-                nlappend(&$$->block.stmts, &$$->block.nstmts, $1);
-            }
+            {$$ = mkblock(line, mkstab());
+             if ($1)
+                nlappend(&$$->block.stmts, &$$->block.nstmts, $1);}
         | blockbody stmt
-            {nlappend(&$$->block.stmts, &$$->block.nstmts, $2);}
+            {if ($2)
+                nlappend(&$$->block.stmts, &$$->block.nstmts, $2);}
         ;
 
 label   : TColon TIdent
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -411,7 +411,7 @@
 {
     static Type *tyint;
     int i;
-    //char buf[1024];
+    char buf[1024];
 
     if (!tyint)
         tyint = mkty(-1, Tyint);