1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Allows one trailing comma before the closing curly of a struct/union initializer.

This commit is contained in:
acqn 2020-07-29 15:09:53 +08:00 committed by Oliver Schmidt
parent 25d10d9d9a
commit 9075a853dc

View File

@ -2230,6 +2230,13 @@ static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers)
/* Check for excess elements */
if (Entry == 0) {
/* Is there just one trailing comma before a closing curly? */
if (NextTok.Tok == TOK_RCURLY && CurTok.Tok == TOK_COMMA) {
/* Skip comma and exit scope */
NextToken ();
break;
}
if (HasCurly) {
Error ("Excess elements in %s initializer", GetBasicTypeName (T));
SkipInitializer (HasCurly);