mirror of
https://github.com/cc65/cc65.git
synced 2024-06-26 05:29:30 +00:00
Merge pull request #2271 from acqn/InternalFix
[cc65] Fixed assertion failure when there is an undeclared symbol used in a parameter list
This commit is contained in:
commit
2af16ee82b
|
@ -1902,6 +1902,7 @@ static FuncDesc* ParseFuncDecl (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse params */
|
/* Parse params */
|
||||||
|
PushLexicalLevel (LEX_LEVEL_PARAM_LIST);
|
||||||
if ((F->Flags & FD_OLDSTYLE) == 0) {
|
if ((F->Flags & FD_OLDSTYLE) == 0) {
|
||||||
/* New-style function */
|
/* New-style function */
|
||||||
ParseAnsiParamList (F);
|
ParseAnsiParamList (F);
|
||||||
|
@ -1909,6 +1910,7 @@ static FuncDesc* ParseFuncDecl (void)
|
||||||
/* Old-style function */
|
/* Old-style function */
|
||||||
ParseOldStyleParamList (F);
|
ParseOldStyleParamList (F);
|
||||||
}
|
}
|
||||||
|
PopLexicalLevel ();
|
||||||
|
|
||||||
/* Remember the last function parameter. We need it later for several
|
/* Remember the last function parameter. We need it later for several
|
||||||
** purposes, for example when passing stuff to fastcall functions. Since
|
** purposes, for example when passing stuff to fastcall functions. Since
|
||||||
|
|
|
@ -1221,7 +1221,14 @@ SymEntry* AddLocalSym (const char* Name, const Type* T, unsigned Flags, int Offs
|
||||||
ident Ident;
|
ident Ident;
|
||||||
|
|
||||||
/* Do we have an entry with this name already? */
|
/* Do we have an entry with this name already? */
|
||||||
SymEntry* Entry = FindSymInTable (Tab, Name, HashStr (Name));
|
SymEntry* Entry;
|
||||||
|
|
||||||
|
/* HACK: only allows to add parameter symbols in a parameter list */
|
||||||
|
if ((Flags & SC_PARAM) == 0 && GetLexicalLevel () == LEX_LEVEL_PARAM_LIST) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry = FindSymInTable (Tab, Name, HashStr (Name));
|
||||||
|
|
||||||
if (Entry) {
|
if (Entry) {
|
||||||
int CheckExtern = 0;
|
int CheckExtern = 0;
|
||||||
|
@ -1419,7 +1426,9 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
|
||||||
/* Add an alias of the global symbol to the local symbol table */
|
/* Add an alias of the global symbol to the local symbol table */
|
||||||
if (Tab == SymTab0 && SymTab != SymTab0 && Entry->Owner != SymTab && Alias == 0) {
|
if (Tab == SymTab0 && SymTab != SymTab0 && Entry->Owner != SymTab && Alias == 0) {
|
||||||
Alias = AddLocalSym (Name, T, SC_ALIAS, 0);
|
Alias = AddLocalSym (Name, T, SC_ALIAS, 0);
|
||||||
Alias->V.A.Field = Entry;
|
if (Alias != 0) {
|
||||||
|
Alias->V.A.Field = Entry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the entry */
|
/* Return the entry */
|
||||||
|
|
|
@ -78,6 +78,7 @@ struct LexicalLevel {
|
||||||
#define LEX_LEVEL_FUNCTION 2U
|
#define LEX_LEVEL_FUNCTION 2U
|
||||||
#define LEX_LEVEL_BLOCK 3U
|
#define LEX_LEVEL_BLOCK 3U
|
||||||
#define LEX_LEVEL_STRUCT 4U
|
#define LEX_LEVEL_STRUCT 4U
|
||||||
|
#define LEX_LEVEL_PARAM_LIST 5U /* HACK for error recovery */
|
||||||
|
|
||||||
/* Forwards */
|
/* Forwards */
|
||||||
struct FuncDesc;
|
struct FuncDesc;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user