shithub: mc

Download patch

ref: a2d560c05bd359bc0d1afcd5061ce7aadfdab1c7
parent: 1eaac761440473141e996d6a0f2516ffbf8f2131
author: Ori Bernstein <[email protected]>
date: Mon May 7 17:36:41 EDT 2012

Don't try to add empty structelts

    Empty lines in structs generate NULL scructelt lines, thanks to
    the way we defined the grammar. This is not something we allow
    in the struct, so we need to filter them out.

--- a/parse/gram.y
+++ b/parse/gram.y
@@ -276,7 +276,7 @@
 
 structbody
         : structelt
-            {$$.nl = NULL; $$.nn = 0; lappend(&$$.nl, &$$.nn, $1);}
+            {if ($1) {$$.nl = NULL; $$.nn = 0; lappend(&$$.nl, &$$.nn, $1);}}
         | structbody structelt
             {if ($2) {lappend(&$$.nl, &$$.nn, $2);}}
         ;