/* processParms - makes sure the parameters are okay and do some */
/* processing with them */
/*-----------------------------------------------------------------*/
-int processParms (ast *func, value *defParm,
- ast *actParm,
- int *parmNumber)
+int processParms (ast *func,
+ value *defParm,
+ ast *actParm,
+ int *parmNumber,
+ bool rightmost)
{
sym_link *fetype = func->etype;
}
else if ( actParm->type == EX_OP && actParm->opval.op == PARAM)
{
- return (processParms (func,NULL,actParm->left,parmNumber) ||
- processParms (func,NULL,actParm->right,parmNumber) );
+ return (processParms(func,NULL,actParm->left,parmNumber,FALSE) ||
+ processParms(func,NULL,actParm->right,parmNumber,rightmost));
}
return 0;
}
resolveSymbols(actParm);
/* if this is a PARAM node then match left & right */
- if ( actParm->type == EX_OP && actParm->opval.op == PARAM) {
- return (processParms (func,defParm,actParm->left,parmNumber) ||
- processParms (func,defParm->next, actParm->right,parmNumber) );
+ if ( actParm->type == EX_OP && actParm->opval.op == PARAM)
+ {
+ return (processParms(func,defParm,actParm->left,parmNumber,FALSE) ||
+ processParms(func,defParm->next, actParm->right,parmNumber,rightmost));
}
-#if 0
- /* Pending discussion with Johan. */
- else {
- /* if more defined parameters present but no more actual parameters */
- if (defParm->next) {
- werror(E_TOO_FEW_PARMS);
- return 1;
- }
+ else
+ {
+ /* If we have found a value node by following only right-hand links,
+ * then we know that there are no more values after us.
+ *
+ * Therefore, if there are more defined parameters, the caller didn't
+ * supply enough.
+ */
+ if (rightmost && defParm->next)
+ {
+ werror(E_TOO_FEW_PARMS);
+ return 1;
+ }
}
-#endif
-
- /* the parameter type must be atleast castable */
+
+ /* the parameter type must be at least castable */
if (checkType(defParm->type,actParm->ftype) == 0) {
werror(E_TYPE_MISMATCH_PARM,*parmNumber);
werror(E_CONTINUE,"defined type ");
if (processParms (tree->left,
tree->left->args,
- tree->right,&parmNumber))
+ tree->right,&parmNumber,TRUE))
goto errorTreeReturn ;
if (options.stackAuto || IS_RENT(LETYPE(tree))) {
char *errText ;
} ErrTab [] =
{
-{ ERROR ,"error *** Duplicate symbol '%s', symbol IGNORED\n" },
-{ ERROR ,"error *** Syntax Error Declaration ingonerd\n" },
+{ ERROR ,"error *** Duplicate symbol '%s', symbol IGNORED\n" },
+{ ERROR ,"error *** Syntax Error Declaration ignored\n" },
{ ERROR ,"error *** Constant Expected Found Variable\n" },
{ ERROR ,"error *** 'malloc' failed file '%s' for size %ld\n" },
{ ERROR ,"error *** 'fopen' failed on file '%s'\n" },
{ ERROR ,"error *** Internal Error Oclass invalid '%s'\n" },
{ ERROR ,"error *** Cannot allocate variable '%s'.\n" },
{ ERROR ,"error *** Old style C declaration. IGNORED '%s'\n" },
-{ ERROR ,"error *** Out of stack Space. '%s' not allocted\n" },
+{ ERROR ,"error *** Out of stack Space. '%s' not allocated\n" },
{ ERROR ,"error *** FATAL Compiler Internal Error in file '%s' line number '%d' : %s \nContact Author with source code\n" },
{ ERROR ,"error *** 'lvalue' required for '%s' operation .\n" },
{ ERROR ,"error *** Creation of temp file failed\n" },
{ ERROR ,"error *** variable '%s' declared in code space must have initialiser\n" },
{ ERROR ,"error *** operands not integral for assignment operation\n" },
{ ERROR ,"error *** too many parameters \n" },
-{ ERROR ,"error *** to few parameters\n" },
+{ ERROR ,"error *** too few parameters\n" },
{ ERROR ,"error *** code not generated for '%s' due to previous errors\n"},
{ WARNING,"warning *** type mismatch for parameter number %d\n"},
{ ERROR ,"error *** invalid float constant '%s'\n"},