From 0b7d9d8216a4f94d76cad6f587f9277b50410836 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 1 Jan 2024 14:48:05 +0800 Subject: [PATCH] Fixed missing calling convention and address size qualifiers in diagnosis on function types. --- src/cc65/datatype.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index a8b7735b0..b2511cf1b 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -1454,6 +1454,7 @@ static struct StrBuf* GetFullTypeNameWestEast (struct StrBuf* West, struct StrBu } else if (IsTypeFunc (T)) { + int QualCount = 0; struct StrBuf ParamList = AUTO_STRBUF_INITIALIZER; const FuncDesc* D = GetFuncDesc (T); @@ -1467,13 +1468,27 @@ static struct StrBuf* GetFullTypeNameWestEast (struct StrBuf* West, struct StrBu SB_Clear (East); } + /* Add qualifiers */ + if ((GetQualifier (T) & ~T_QUAL_NEAR) != T_QUAL_NONE) { + QualCount = GetQualifierTypeCodeNameBuf (&Buf, T->C, T_QUAL_NEAR); + if (QualCount > 0) { + SB_AppendChar (&Buf, ' '); + } + } + if (SB_IsEmpty (West)) { - /* Just use the param list */ - SB_Printf (West, "(%s)", SB_GetConstBuf (&ParamList)); + /* Use no parentheses */ + SB_Terminate (&Buf); + + /* Append the param list to the West */ + SB_Printf (West, "%s(%s)", SB_GetConstBuf (&Buf), SB_GetConstBuf (&ParamList)); } else { - /* Append the param list to the existing West */ - SB_Printf (&Buf, "(%s)(%s)", SB_GetConstBuf (West), SB_GetConstBuf (&ParamList)); - SB_Printf (West, "%s", SB_GetConstBuf (&Buf)); + /* Append the existing West */ + SB_Append (&Buf, West); + SB_Terminate (&Buf); + + /* Append the param list to the West */ + SB_Printf (West, "(%s)(%s)", SB_GetConstBuf (&Buf), SB_GetConstBuf (&ParamList)); } SB_Done (&ParamList);