From 0de080001628cebd436f7fbb070234c83c6bff64 Mon Sep 17 00:00:00 2001 From: johanknol Date: Wed, 31 Oct 2001 10:14:13 +0000 Subject: [PATCH] fixed bug #476632 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1477 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCast.c | 2 +- src/SDCCsymt.c | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/SDCCast.c b/src/SDCCast.c index 4f52b340..41eb8313 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -734,7 +734,7 @@ processParms (ast * func, * Therefore, if there are more defined parameters, the caller didn't * supply enough. */ - if (0 && rightmost && defParm->next) + if (rightmost && defParm->next) { werror (E_TOO_FEW_PARMS); return 1; diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index da4212bd..be8444e8 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1764,23 +1764,29 @@ processFuncArgs (symbol * func, int ignoreName) { value *val; int pNum = 1; + sym_link *funcType=func->type; + + // if this is a pointer to a function + if (DCL_TYPE(funcType)==CPOINTER) { + funcType=funcType->next; + } /* if this function has variable argument list */ /* then make the function a reentrant one */ - if (IFFUNC_HASVARARGS(func->type)) - FUNC_ISREENT(func->type)=1; + if (IFFUNC_HASVARARGS(funcType)) + FUNC_ISREENT(funcType)=1; /* check if this function is defined as calleeSaves then mark it as such */ - FUNC_CALLEESAVES(func->type) = inCalleeSaveList (func->name); + FUNC_CALLEESAVES(funcType) = inCalleeSaveList (func->name); /* loop thru all the arguments */ - val = FUNC_ARGS(func->type); + val = FUNC_ARGS(funcType); /* if it is void then remove parameters */ if (val && IS_VOID (val->type)) { - FUNC_ARGS(func->type) = NULL; + FUNC_ARGS(funcType) = NULL; return; } @@ -1793,7 +1799,7 @@ processFuncArgs (symbol * func, int ignoreName) /* mark it as a register parameter if the function does not have VA_ARG and as port dictates */ - if (!IFFUNC_HASVARARGS(func->type) && + if (!IFFUNC_HASVARARGS(funcType) && (*port->reg_parm) (val->type)) { SPEC_REGPARM (val->etype) = 1; @@ -1811,17 +1817,17 @@ processFuncArgs (symbol * func, int ignoreName) if (func->cdef) { /* ignore --stack-auto for this one, we don't know how it is compiled */ /* simply trust on --int-long-reent or --float-reent */ - if (IFFUNC_ISREENT(func->type)) { + if (IFFUNC_ISREENT(funcType)) { return; } } else { /* if this function is reentrant or */ /* automatics r 2b stacked then nothing */ - if (IFFUNC_ISREENT (func->type) || options.stackAuto) + if (IFFUNC_ISREENT (funcType) || options.stackAuto) return; } - val = FUNC_ARGS(func->type); + val = FUNC_ARGS(funcType); pNum = 1; while (val) { -- 2.47.2