dest->level = src->level;
dest->funcName = src->funcName;
+ if (src->ftype)
+ dest->etype = getSpec (dest->ftype = copyLinkChain (src->ftype));
+
/* if this is a leaf */
/* if value */
if (src->type == EX_VALUE)
/* if this is a node that has special values */
copyAstValues (dest, src);
- if (src->ftype)
- dest->etype = getSpec (dest->ftype = copyLinkChain (src->ftype));
-
dest->trueLabel = copySymbol (src->trueLabel);
dest->falseLabel = copySymbol (src->falseLabel);
dest->left = copyAst (src->left);
/* the parameter type must be at least castable */
if (compareType (defParm->type, actParm->ftype) == 0) {
werror (E_INCOMPAT_TYPES);
- fprintf (stderr, "type --> '");
- printTypeChain (actParm->ftype, stderr);
- fprintf (stderr, "' ");
- fprintf (stderr, "assigned to type --> '");
- printTypeChain (defParm->type, stderr);
- fprintf (stderr, "'\n");
+ printFromToType (actParm->ftype, defParm->type);
return 1;
}
createIvalStruct (ast * sym, sym_link * type, initList * ilist)
{
ast *rast = NULL;
+ ast *lAst;
symbol *sflds;
initList *iloop;
for (; sflds; sflds = sflds->next, iloop = (iloop ? iloop->next : NULL))
{
- ast *lAst;
-
/* if we have come to end */
if (!iloop)
break;
/* if bit field then error */
if (IS_BITVAR (tree->left->etype))
{
- werror (E_ILLEGAL_ADDR, "addrress of bit variable");
+ werror (E_ILLEGAL_ADDR, "address of bit variable");
goto errorTreeReturn;
}
goto errorTreeReturn;
}
- if (LRVAL (tree))
+ if (IS_LITERAL(LTYPE(tree)))
+ {
+ werror (E_ILLEGAL_ADDR, "address of literal");
+ goto errorTreeReturn;
+ }
+
+ if (LRVAL (tree))
{
werror (E_LVALUE_REQUIRED, "address of");
goto errorTreeReturn;
if (IS_VOID (LTYPE (tree)))
{
werror (E_CAST_ZERO);
- fprintf (stderr, "type --> '");
- printTypeChain (RTYPE (tree), stderr);
- fprintf (stderr, "' ");
- fprintf (stderr, "assigned to type --> '");
- printTypeChain (LTYPE (tree), stderr);
- fprintf (stderr, "'\n");
+ printFromToType(RTYPE(tree), LTYPE(tree));
}
TETYPE (tree) = getSpec (TTYPE (tree) =
if (compareType (currFunc->type->next, RTYPE (tree)) == 0)
{
werror (W_RETURN_MISMATCH);
- fprintf (stderr, "from type '");
- printTypeChain (RTYPE(tree), stderr);
- fprintf (stderr, "' to type '");
- printTypeChain (currFunc->type->next, stderr);
- fprintf (stderr, "'\n");
+ printFromToType (RTYPE(tree), currFunc->type->next);
goto errorTreeReturn;
}