dest->level = src->level;
dest->funcName = src->funcName;
dest->reversed = src->reversed;
- dest->actualArgument = src->actualArgument;
if (src->ftype)
dest->etype = getSpec (dest->ftype = copyLinkChain (src->ftype));
}
}
- /* mark the actual parameter */
- (*actParm)->actualArgument = 1;
-
/* decorate parameter */
resultType = defParm ? getResultTypeFromType (defParm->type) :
RESULT_TYPE_NONE;
ast *newType = NULL;
sym_link *ftype;
- int isCast = IS_CAST_OP (*actParm);
- int isAstLitValue = (IS_AST_LIT_VALUE (*actParm));
-
- if (IS_CAST_OP (*actParm)
- || (IS_AST_LIT_VALUE (*actParm) && (*actParm)->values.literalFromCast))
+ /* don't perform integer promotion of explicitly typecasted variable arguments
+ * if sdcc extensions are enabled */
+ if (options.std_sdcc &&
+ (IS_CAST_OP (*actParm) ||
+ (IS_AST_SYM_VALUE (*actParm) && AST_VALUES (*actParm, removedCast)) ||
+ (IS_AST_LIT_VALUE (*actParm) && AST_VALUES (*actParm, literalFromCast))))
{
/* Parameter was explicitly typecast; don't touch it. */
return 0;
checkTypeSanity(LETYPE(tree), "(cast)");
- /* if not an actual argument and
- * if 'from' and 'to' are the same remove the superfluous cast,
+ /* if 'from' and 'to' are the same remove the superfluous cast,
* this helps other optimizations */
- if (!tree->actualArgument && compareTypeExact (LTYPE(tree), RTYPE(tree), -1) == 1)
+ if (compareTypeExact (LTYPE(tree), RTYPE(tree), -1) == 1)
{
+ /* mark that the explicit cast has been removed,
+ * for proper processing (no integer promotion) of explicitly typecasted variable arguments */
+ tree->right->values.removedCast = 1;
return tree->right;
}