From 4e61ae5b3620a1003985d53e28d9dd160e51b915 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 15 Aug 2020 06:27:11 +0800 Subject: [PATCH] Fixed function parameter type conversion. --- src/cc65/declare.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index d7851bd44..4e8446176 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -1492,13 +1492,27 @@ static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers, static Type* ParamTypeCvt (Type* T) -/* If T is an array, convert it to a pointer else do nothing. Return the -** resulting type. +/* If T is an array or a function, convert it to a pointer else do nothing. +** Return the resulting type. */ { + Type* Tmp = 0; + if (IsTypeArray (T)) { - T->C = T_PTR; + Tmp = ArrayToPtr (T); + } else if (IsTypeFunc (T)) { + Tmp = PointerTo (T); } + + if (Tmp != 0) { + /* Do several fixes on qualifiers */ + FixQualifiers (Tmp); + + /* Replace the type */ + TypeCopy (T, Tmp); + TypeFree (Tmp); + } + return T; }