diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 7f1d8b948..c3c1160a6 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -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; diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 28e263bb8..8bf7aa1d2 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -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;