Fixed repeated diagnosis when reading EOF in certain cases.

This commit is contained in:
acqn 2024-01-15 23:56:11 +08:00
parent de3087a7e9
commit afdf398a0b
2 changed files with 6 additions and 4 deletions

View File

@ -997,7 +997,7 @@ static SymEntry* ParseUnionSpec (const char* Name, unsigned* DSFlags)
/* Parse union fields */
UnionSize = 0;
while (CurTok.Tok != TOK_RCURLY) {
while (CurTok.Tok != TOK_RCURLY && CurTok.Tok != TOK_CEOF) {
/* Get the type of the entry */
DeclSpec Spec;
@ -1217,7 +1217,7 @@ static SymEntry* ParseStructSpec (const char* Name, unsigned* DSFlags)
FlexibleMember = 0;
StructSize = 0;
BitOffs = 0;
while (CurTok.Tok != TOK_RCURLY) {
while (CurTok.Tok != TOK_RCURLY && CurTok.Tok != TOK_CEOF) {
/* Get the type of the entry */
DeclSpec Spec;
@ -1814,7 +1814,7 @@ static void ParseOldStyleParamDeclList (FuncDesc* F attribute ((unused)))
}
/* An optional list of type specifications follows */
while (CurTok.Tok != TOK_LCURLY) {
while (CurTok.Tok != TOK_LCURLY && CurTok.Tok != TOK_CEOF) {
DeclSpec Spec;
int NeedClean;

View File

@ -551,7 +551,9 @@ void DeclareLocals (void)
/* A place to store info about potential initializations of auto variables */
CollAppend (&CurrentFunc->LocalsBlockStack, 0);
/* Loop until we don't find any more variables */
/* Loop until we don't find any more variables. EOF is handled in the loop
** as well.
*/
while (1) {
DeclSpec Spec;
int NeedClean;