ref: 1ad61425f50fc4f6dc66ccbc6bca4c6330b8027c
parent: afd74c04166cc70a18f519ffab65c6e9cf125e86
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jul 5 17:51:40 EDT 2013
Fix bug in decl decl was returning NULL in the case of empty declarations, and in this case it means no more declarations were scanned. This patch force to decl() to follow scanning until it find a correct correct declaration, or a non declaration.
--- a/decl.c
+++ b/decl.c
@@ -216,25 +216,22 @@
decl(void)
{
register struct ctype *tp;
- register struct node *np = NULL;
+repeat:
if (!(tp = spec())) {
if (curctx != CTX_OUTER || yytoken != IDEN)
- goto end;
+ return NULL;
tp = newctype();
tp->type = INT;
warning_error(options.implicit,
"data definition has no type or storage class");
- }
- if (accept(';')) {
+ } else if (accept(';')) {
warning_error(options.useless,
"useless type name in empty declaration");
delctype(tp);
- } else {
- np = listdcl(tp);
+ goto repeat;
}
-
-end: return np;
+ return listdcl(tp);
}
void