int *parmNumber,
bool rightmost)
{
+ int castError=0;
sym_link *fetype = func->etype;
/* if none of them exist */
/* have parameters */
if (func->type != EX_VALUE && !IS_RENT (fetype) && !options.stackAuto)
{
- werror (E_NONRENT_ARGS);
+ werror (W_NONRENT_ARGS);
return 1;
}
/* the parameter type must be at least castable */
if (compareType (defParm->type, actParm->ftype) == 0)
{
- werror (E_TYPE_MISMATCH_PARM, *parmNumber);
- werror (E_CONTINUE, "defined type ");
- printTypeChain (defParm->type, stderr);
- fprintf (stderr, "\n");
- werror (E_CONTINUE, "actual type ");
- printTypeChain (actParm->ftype, stderr);
- fprintf (stderr, "\n");
+ castError++;
}
+ if (!IS_SPEC(defParm->type) && !IS_SPEC(actParm->ftype)) {
+ // now we have two pointers, check if they point to the same
+ sym_link *dtype=defParm->type->next, *atype=actParm->ftype->next;
+ do {
+ if (
+ (dtype->next && !atype->next) ||
+ (!dtype->next && atype->next) ||
+ compareType (dtype, atype)!=1) {
+ castError++;
+ }
+ } while (dtype->next && atype->next);
+ if (IS_SPEC(dtype) && IS_SPEC(atype)) {
+ // ok so far, we have two etypes, they must have the same SCLASS
+ if (SPEC_SCLS(dtype)!=SPEC_SCLS(atype)) {
+ castError++;
+ }
+ }
+ }
+ if (castError) {
+ werror (W_INCOMPAT_CAST);
+ fprintf (stderr, "type --> '");
+ printTypeChain (actParm->ftype, stderr);
+ fprintf (stderr, "' ");
+ fprintf (stderr, "assigned to type --> '");
+ printTypeChain (defParm->type, stderr);
+ fprintf (stderr, "'\n");
+ }
+
+
+
/* if the parameter is castable then add the cast */
if (compareType (defParm->type, actParm->ftype) < 0)
{
if (!IS_INTEGRAL (LTYPE (tree)) || !IS_INTEGRAL (RTYPE (tree)))
{
werror (E_BITWISE_OP);
- werror (E_CONTINUE, "left & right types are ");
+ werror (W_CONTINUE, "left & right types are ");
printTypeChain (LTYPE (tree), stderr);
fprintf (stderr, ",");
printTypeChain (RTYPE (tree), stderr);
if (!IS_INTEGRAL (LTYPE (tree)) || !IS_INTEGRAL (RTYPE (tree)))
{
werror (E_BITWISE_OP);
- werror (E_CONTINUE, "left & right types are ");
+ werror (W_CONTINUE, "left & right types are ");
printTypeChain (LTYPE (tree), stderr);
fprintf (stderr, ",");
printTypeChain (RTYPE (tree), stderr);
if (!IS_INTEGRAL (LTYPE (tree)) || !IS_INTEGRAL (RTYPE (tree)))
{
werror (E_BITWISE_OP);
- werror (E_CONTINUE, "left & right types are ");
+ werror (W_CONTINUE, "left & right types are ");
printTypeChain (LTYPE (tree), stderr);
fprintf (stderr, ",");
printTypeChain (RTYPE (tree), stderr);
if (!IS_INTEGRAL (LTYPE (tree)) || !IS_INTEGRAL (tree->left->etype))
{
werror (E_SHIFT_OP_INVALID);
- werror (E_CONTINUE, "left & right types are ");
+ werror (W_CONTINUE, "left & right types are ");
printTypeChain (LTYPE (tree), stderr);
fprintf (stderr, ",");
printTypeChain (RTYPE (tree), stderr);
if (compareType (currFunc->type->next, RTYPE (tree)) == 0)
{
- werror (E_RETURN_MISMATCH);
+ werror (W_RETURN_MISMATCH);
goto errorTreeReturn;
}