From: johanknol Date: Sat, 4 Jan 2003 18:26:51 +0000 (+0000) Subject: finalized the implicit integer promotion X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ee6328c54cfc9f167456fba82751e498fc5b586d;p=fw%2Fsdcc finalized the implicit integer promotion git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2135 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCast.c b/src/SDCCast.c index 449368c0..f8d5e58c 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -1,5 +1,3 @@ -//#define JWK_FIX_SHIFT_BUG -//#define JWK_FIX_IMPLICIT_CAST /*------------------------------------------------------------------------- SDCCast.c - source file for parser support & all ast related routines @@ -669,7 +667,6 @@ processParms (ast * func, if (IS_INTEGRAL (ftype) && (getSize (ftype) < (unsigned) INTSIZE)) { -#ifdef JWK_FIX_IMPLICIT_CAST if (IS_AST_OP(actParm) && (actParm->opval.op == LEFT_OP || actParm->opval.op == '*' || @@ -684,9 +681,6 @@ processParms (ast * func, } else { newType = newAst_LINK(INTTYPE); } -#else - newType = newAst_LINK(INTTYPE); -#endif } if (IS_PTR(ftype) && !IS_GENPTR(ftype)) @@ -1978,7 +1972,6 @@ decorateType (ast * tree) if (dtr != tree->right) tree->right = dtr; -#ifdef JWK_FIX_IMPLICIT_CAST if (IS_AST_OP(tree) && (tree->opval.op == CAST || tree->opval.op == '=') && (getSize(LTYPE(tree)) > getSize(RTYPE(tree))) && @@ -1997,23 +1990,6 @@ decorateType (ast * tree) tree->right = decorateType(tree->right); } } -#else - /* special case for left shift operation : cast up right->left if type - of left has greater size than right */ - if (tree->left && tree->right && tree->right->opval.op == LEFT_OP) { - int lsize = getSize(LTYPE(tree)); - int rsize = getSize(RTYPE(tree)); - - if (lsize > rsize) { - tree->right->decorated = 0; - tree->right->left = newNode( CAST, (lsize == 2 ? - newAst_LINK(newIntLink()) : - newAst_LINK(newLongLink())), - tree->right->left); - tree->right = decorateType(tree->right); - } - } -#endif } /* depending on type of operator do */ @@ -2733,7 +2709,6 @@ decorateType (ast * tree) ((unsigned) floatFromVal (valFromType (RETYPE (tree)))) >= (getSize (LTYPE (tree)) * 8)) { -#ifdef JWK_FIX_SHIFT_BUG if (tree->opval.op==LEFT_OP || (tree->opval.op==RIGHT_OP && SPEC_USIGN(LETYPE(tree)))) { lineno=tree->lineno; @@ -2745,26 +2720,6 @@ decorateType (ast * tree) TETYPE (tree) = TTYPE (tree) = tree->opval.val->type; return tree; } -#else - /* if left shift then cast up */ - if (tree->opval.op==LEFT_OP) { - int size = getSize(LTYPE(tree)); - tree->left = - decorateType (newNode (CAST, - (size == 1 ? newAst_LINK(newIntLink()) : - (size == 2 ? newAst_LINK(newLongLink()) : - newAst_LINK(newIntLink()))), - tree->left)); - } else { - werror (W_SHIFT_CHANGED, - (tree->opval.op == LEFT_OP ? "left" : "right")); - tree->type = EX_VALUE; - tree->left = tree->right = NULL; - tree->opval.val = constVal ("0"); - TETYPE (tree) = TTYPE (tree) = tree->opval.val->type; - return tree; - } -#endif } LRVAL (tree) = RRVAL (tree) = 1; if (IS_LITERAL (LTYPE (tree)) && !IS_LITERAL (RTYPE (tree)))