mirror of
https://github.com/cc65/cc65.git
synced 2025-01-25 11:30:06 +00:00
Improved error recovery in declarations with curly braces.
This commit is contained in:
parent
eb595b1f5f
commit
3af77e7333
@ -1891,12 +1891,21 @@ static void DirectDecl (const DeclSpec* Spec, Declarator* D, declmode_t Mode)
|
|||||||
} else {
|
} else {
|
||||||
if (Mode == DM_NEED_IDENT) {
|
if (Mode == DM_NEED_IDENT) {
|
||||||
/* Some fix point tokens that are used for error recovery */
|
/* Some fix point tokens that are used for error recovery */
|
||||||
static const token_t TokenList[] = { TOK_COMMA, TOK_SEMI };
|
static const token_t TokenList[] = { TOK_COMMA, TOK_SEMI, TOK_LCURLY, TOK_RCURLY };
|
||||||
|
|
||||||
Error ("Identifier expected");
|
Error ("Identifier expected");
|
||||||
|
|
||||||
/* Try some smart error recovery */
|
/* Try some smart error recovery */
|
||||||
SkipTokens (TokenList, sizeof(TokenList) / sizeof(TokenList[0]));
|
SkipTokens (TokenList, sizeof(TokenList) / sizeof(TokenList[0]));
|
||||||
|
|
||||||
|
/* Skip curly braces */
|
||||||
|
if (CurTok.Tok == TOK_LCURLY) {
|
||||||
|
static const token_t CurlyToken[] = { TOK_RCURLY };
|
||||||
|
SkipTokens (CurlyToken, sizeof(CurlyToken) / sizeof(CurlyToken[0]));
|
||||||
|
NextToken ();
|
||||||
|
} else if (CurTok.Tok == TOK_RCURLY) {
|
||||||
|
NextToken ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
D->Ident[0] = '\0';
|
D->Ident[0] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
bug1889-missing-identifier.c:3: Error: Identifier expected
|
bug1889-missing-identifier.c:3: Error: Identifier expected
|
||||||
|
bug1889-missing-identifier.c:3: Error: ';' expected
|
||||||
|
bug1889-missing-identifier.c:3: Warning: Implicit 'int' is an obsolete feature
|
||||||
bug1889-missing-identifier.c:4: Error: Identifier expected
|
bug1889-missing-identifier.c:4: Error: Identifier expected
|
||||||
bug1889-missing-identifier.c:4: Warning: Implicit 'int' is an obsolete feature
|
bug1889-missing-identifier.c:4: Warning: Implicit 'int' is an obsolete feature
|
||||||
|
Loading…
x
Reference in New Issue
Block a user