ref: a80c579064560b4bcf8ed28ed857b6265dc5fd37
parent: 8e517c601fa233750a08f2ce8f8656557486d76a
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Nov 2 04:36:25 EDT 2021
cc1: Accept , at the end of initlist A trailing comma is accepted at the end of a initializer.
--- a/src/cmd/cc/cc1/init.c
+++ b/src/cmd/cc/cc1/init.c
@@ -223,7 +223,7 @@
if (accept('{'))
braces = 1;
- do {
+ for (;;) {
curtp = inttype;
switch (yytoken) {
case '[':
@@ -291,7 +291,11 @@
errorp("compound literal too big");
if (nelem == in.pos && !braces)
break;
- } while (accept(','));
+ if (!accept(','))
+ break;
+ if (yytoken == '}')
+ break;
+ }
if (braces)
expect('}');