X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCast.c;h=cfa68e040219774a5e2e6f8444d669321787e816;hb=57b5edb25dcb2872d2c3e9789173bc9423959bec;hp=a67b3ba104fedf84584348735d15ee4e327048a3;hpb=4e5860a07055d3dbc2e2c8b5c52e395db67fc963;p=fw%2Fsdcc diff --git a/src/SDCCast.c b/src/SDCCast.c index a67b3ba1..cfa68e04 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -414,6 +414,9 @@ int setAstLineno ( ast *tree, int lineno) return 0; } +#if 0 +/* this functions seems to be superfluous?! kmh */ + /*-----------------------------------------------------------------*/ /* resolveFromTable - will return the symbal table value */ /*-----------------------------------------------------------------*/ @@ -439,6 +442,7 @@ value *resolveFromTable (value *val) return val; } +#endif /*-----------------------------------------------------------------*/ /* funcOfType :- function of type with name */ @@ -577,10 +581,12 @@ int processParms (ast *func, value *defParm, actParm->ftype= defParm->type; } - actParm->argSym = resolveFromTable(defParm)->sym ; +/* actParm->argSym = resolveFromTable(defParm)->sym ; */ + actParm->argSym = defParm->sym; /* make a copy and change the regparm type to the defined parm */ actParm->etype = getSpec(actParm->ftype = copyLinkChain(actParm->ftype)); SPEC_REGPARM(actParm->etype) = SPEC_REGPARM(defParm->etype); + (*parmNumber)++; return 0; } /*-----------------------------------------------------------------*/ @@ -624,7 +630,7 @@ ast *createIvalStruct (ast *sym,link *type,initList *ilist) sflds->implicit = 1; lAst = newNode(PTR_OP,newNode('&',sym,NULL),newAst(EX_VALUE,symbolVal(sflds))); lAst = decorateType(resolveSymbols(lAst)); - rast = createIval (lAst, sflds->type, iloop,rast); + rast = decorateType(resolveSymbols(createIval (lAst, sflds->type, iloop,rast))); } return rast ; } @@ -647,7 +653,7 @@ ast *createIvalArray (ast *sym, link *type, initList *ilist) type, decorateType(resolveSymbols(list2expr(ilist)))))) - return rast; + return decorateType(resolveSymbols(rast)); /* not the special case */ if (ilist->type != INIT_DEEP) { @@ -683,7 +689,7 @@ ast *createIvalArray (ast *sym, link *type, initList *ilist) if (!DCL_ELEM(type)) DCL_ELEM(type) = size; - return rast; + return decorateType(resolveSymbols(rast)); } @@ -728,7 +734,7 @@ ast *createIvalCharPtr (ast *sym, link *type, ast *iexpr) newNode('[', sym, newAst(EX_VALUE,valueFromLit(i))), newAst(EX_VALUE,valueFromLit(*s)))); - return rast; + return decorateType(resolveSymbols(rast)); } return NULL ; @@ -782,9 +788,9 @@ ast *createIval (ast *sym, link *type, initList *ilist, ast *wid) if (IS_SPEC(type)) rast = createIvalType (sym,type,ilist); if ( wid ) - return newNode(NULLOP,wid,rast); + return decorateType(resolveSymbols(newNode(NULLOP,wid,rast))); else - return rast ; + return decorateType(resolveSymbols(rast)) ; } /*-----------------------------------------------------------------*/ @@ -2787,14 +2793,20 @@ ast *backPatchLabels (ast *tree, symbol *trueLabel, symbol *falseLabel ) /* change not */ if (IS_NOT(tree)) { + int wasnot = IS_NOT(tree->left); tree->left = backPatchLabels (tree->left,falseLabel,trueLabel); /* if the left is already a IFX */ if ( ! IS_IFX(tree->left) ) tree->left = newNode (IFX,tree->left,NULL); - tree->left->trueLabel = falseLabel ; - tree->left->falseLabel= trueLabel ; + if (wasnot) { + tree->left->trueLabel = trueLabel ; + tree->left->falseLabel= falseLabel ; + } else { + tree->left->trueLabel = falseLabel ; + tree->left->falseLabel= trueLabel ; + } return tree->left ; } @@ -3531,8 +3543,9 @@ ast *createFunction (symbol *name, ast *body ) we need to add the name to the publics list : this actually means we are now compiling the compiler support routine */ - if (name->cdef) + if (name->cdef) { addSet(&publics,name); + } } else { addSymChain(name); @@ -3576,7 +3589,7 @@ ast *createFunction (symbol *name, ast *body ) name->stack = SPEC_STAK(fetype) = stack; /* name needs to be mangled */ - sprintf (name->rname,"_%s",name->name); + sprintf (name->rname,"%s%s", port->fun_prefix, name->name); body = resolveSymbols(body); /* resolve the symbols */ body = decorateType (body); /* propagateType & do semantic checks */ @@ -3626,7 +3639,7 @@ ast *createFunction (symbol *name, ast *body ) addSet(&operKeyReset,name); applyToSet(operKeyReset,resetParmKey); - if (options.debug) + if (options.debug && !options.nodebug) cdbStructBlock(1,cdbFile); cleanUpLevel(LabelTab,0);