1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Made function signatures in asm output use the parameter lists from original definitions instead of the composites.

This commit is contained in:
acqn 2020-08-18 20:43:19 +08:00 committed by Oliver Schmidt
parent 36dd82f0e6
commit 9fcde120aa
5 changed files with 24 additions and 2 deletions

View File

@ -596,8 +596,8 @@ void PrintFuncSig (FILE* F, const char* Name, Type* T)
StrBuf East = AUTO_STRBUF_INITIALIZER;
StrBuf West = AUTO_STRBUF_INITIALIZER;
/* Get the function descriptor */
const FuncDesc* D = GetFuncDesc (T);
/* Get the function descriptor used in definition */
const FuncDesc* D = GetFuncDefinitionDesc (T);
/* Get the parameter list string. Start from the first parameter */
SymEntry* Param = D->SymTab->SymHead;
@ -1137,6 +1137,20 @@ Type* GetFuncReturn (Type* T)
FuncDesc* GetFuncDefinitionDesc (Type* T)
/* Get the function descriptor of the function definition */
{
FuncDesc* D;
/* Be sure it's a function type */
CHECK (IsClassFunc (T));
D = GetFuncDesc (T);
return D->FuncDef != 0 ? D->FuncDef : D;
}
long GetElementCount (const Type* T)
/* Get the element count of the array specified in T (which must be of
** array type).

View File

@ -836,6 +836,9 @@ void SetFuncDesc (Type* T, FuncDesc* F);
Type* GetFuncReturn (Type* T) attribute ((const));
/* Return a pointer to the return type of a function or pointer-to-function type */
FuncDesc* GetFuncDefinitionDesc (struct Type* T);
/* Get the function descriptor of the function definition */
long GetElementCount (const Type* T);
/* Get the element count of the array specified in T (which must be of
** array type).

View File

@ -60,6 +60,7 @@ FuncDesc* NewFuncDesc (void)
F->ParamCount = 0;
F->ParamSize = 0;
F->LastParam = 0;
F->FuncDef = 0;
F->WrappedCall = 0;
F->WrappedCallData = 0;

View File

@ -68,6 +68,7 @@ struct FuncDesc {
unsigned ParamCount; /* Number of parameters */
unsigned ParamSize; /* Size of the parameters */
struct SymEntry* LastParam; /* Pointer to last parameter */
struct FuncDesc* FuncDef; /* Descriptor used in definition */
struct SymEntry* WrappedCall; /* Pointer to the WrappedCall */
unsigned char WrappedCallData;/* The WrappedCall's user data */
};

View File

@ -382,6 +382,9 @@ void NewFunc (SymEntry* Func, FuncDesc* D)
SymEntry* Param;
const Type* RType; /* Real type used for struct parameters */
/* Remember this function descriptor used for definition */
GetFuncDesc (Func->Type)->FuncDef = D;
/* Allocate the function activation record for the function */
CurrentFunc = NewFunction (Func, D);