mirror of
https://github.com/cc65/cc65.git
synced 2025-01-25 11:30:06 +00:00
Improved error recovery with K&R-style function declarations.
This commit is contained in:
parent
894ba49cb5
commit
eb595b1f5f
@ -178,7 +178,7 @@ static void Parse (void)
|
|||||||
** or semicolon, it must be followed by a function body.
|
** or semicolon, it must be followed by a function body.
|
||||||
*/
|
*/
|
||||||
if ((Decl.StorageClass & SC_FUNC) != 0) {
|
if ((Decl.StorageClass & SC_FUNC) != 0) {
|
||||||
if (CurTok.Tok != TOK_COMMA && CurTok.Tok != TOK_SEMI) {
|
if (CurTok.Tok == TOK_LCURLY) {
|
||||||
/* A definition */
|
/* A definition */
|
||||||
Decl.StorageClass |= SC_DEF;
|
Decl.StorageClass |= SC_DEF;
|
||||||
|
|
||||||
@ -190,6 +190,10 @@ static void Parse (void)
|
|||||||
FuncDef->Flags = (FuncDef->Flags & ~FD_EMPTY) | FD_VOID_PARAM;
|
FuncDef->Flags = (FuncDef->Flags & ~FD_EMPTY) | FD_VOID_PARAM;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (CurTok.Tok != TOK_COMMA && CurTok.Tok != TOK_SEMI) {
|
||||||
|
Error ("Expected ',' or ';' after top level declarator");
|
||||||
|
}
|
||||||
|
|
||||||
/* Just a declaration */
|
/* Just a declaration */
|
||||||
Decl.StorageClass |= SC_DECL;
|
Decl.StorageClass |= SC_DECL;
|
||||||
}
|
}
|
||||||
@ -325,7 +329,7 @@ static void Parse (void)
|
|||||||
if (CurTok.Tok == TOK_SEMI) {
|
if (CurTok.Tok == TOK_SEMI) {
|
||||||
/* Prototype only */
|
/* Prototype only */
|
||||||
NextToken ();
|
NextToken ();
|
||||||
} else {
|
} else if (CurTok.Tok == TOK_LCURLY) {
|
||||||
/* Parse the function body */
|
/* Parse the function body */
|
||||||
NewFunc (Sym, FuncDef);
|
NewFunc (Sym, FuncDef);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user