Avoid endless loop when encountering EOF while parsing an initializer.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 5 Jul 2012 06:57:58 +0000 (08:57 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 5 Jul 2012 06:57:58 +0000 (08:57 +0200)
parser.c

index f0b35d8..e311633 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2107,12 +2107,8 @@ finish_designator:
                ARR_APP1(initializer_t*, initializers, sub);
 
 error_parse_next:
-               if (token.kind == '}') {
+               if (!next_if(','))
                        break;
-               }
-               add_anchor_token('}');
-               expect(',');
-               rem_anchor_token('}');
                if (token.kind == '}') {
                        break;
                }