int noLineno = 0;
int noAlloc = 0;
-symbol *currFunc;
+symbol *currFunc=NULL;
static ast *createIval (ast *, sym_link *, initList *, ast *);
static ast *createIvalCharPtr (ast *, sym_link *, ast *);
static ast *optimizeCompare (ast *);
ast *autoInit;
if (action == ALLOCATE)
- {
+ {
*stack += allocVariables (tree->values.sym);
autoInit = gatherAutoInit (tree->values.sym);
-
+
/* if there are auto inits then do them */
if (autoInit)
tree->left = newNode (NULLOP, autoInit, tree->left);
- }
+ }
else /* action is deallocate */
deallocLocal (tree->values.sym);
}
{
sym_link *ltc = (tree->right ? RTYPE (tree) : LTYPE (tree));
COPYTYPE (TTYPE (tree), TETYPE (tree), ltc);
- if (!tree->initMode && IS_CONSTANT (TTYPE (tree)))
+ if (!tree->initMode && IS_CONSTANT(TETYPE(tree)))
werror (E_CODE_WRITE, tree->opval.op==INC_OP ? "++" : "--");
if (tree->right)
return tree;
}
LRVAL (tree) = 1;
- TTYPE (tree) = LTYPE (tree);
+ TETYPE(tree) = getSpec (TTYPE (tree) = LTYPE (tree));
return tree;
}
}
/* if unsigned value < 0 then always false */
/* if (unsigned value) > 0 then (unsigned value) */
- if (SPEC_USIGN(LETYPE(tree)) && IS_LITERAL(RTYPE(tree)) &&
+ if (SPEC_USIGN(LETYPE(tree)) && IS_LITERAL(RTYPE(tree)) &&
((int) floatFromVal (valFromType (RETYPE (tree)))) == 0) {
if (tree->opval.op == '<') {
RRVAL (tree) = 1;
TETYPE (tree) = getSpec (TTYPE (tree) = LTYPE (tree));
- if (!tree->initMode && IS_CONSTANT (LTYPE (tree)))
+ if (!tree->initMode && IS_CONSTANT (LETYPE (tree)))
werror (E_CODE_WRITE, "&= or |= or ^= or >>= or <<=");
if (LRVAL (tree))
computeType (LTYPE (tree),
RTYPE (tree)));
- if (!tree->initMode && IS_CONSTANT (LTYPE (tree)))
+ if (!tree->initMode && IS_CONSTANT (LETYPE (tree)))
werror (E_CODE_WRITE, "-=");
if (LRVAL (tree))
computeType (LTYPE (tree),
RTYPE (tree)));
- if (!tree->initMode && IS_CONSTANT (LTYPE (tree)))
+ if (!tree->initMode && IS_CONSTANT (LETYPE (tree)))
werror (E_CODE_WRITE, "+=");
if (LRVAL (tree))
RRVAL (tree) = 1;
LLVAL (tree) = 1;
if (!tree->initMode ) {
- if (IS_CONSTANT (LTYPE (tree)))
+ if ((IS_SPEC(LETYPE(tree)) && IS_CONSTANT (LETYPE (tree))))
werror (E_CODE_WRITE, "=");
}
if (LRVAL (tree))
if (!IS_VOID (currFunc->type->next) && tree->right == NULL)
{
- werror (E_VOID_FUNC, currFunc->name);
+ werror (W_VOID_FUNC, currFunc->name);
goto errorTreeReturn;
}
ast *ex;
/* if the block has nothing */
- if (!body)
+ if (!body && !decl)
return NULL;
ex = newNode (BLOCK, NULL, body);
ex->values.sym = decl;
-
+
ex->right = ex->right;
ex->level++;
ex->lineno = 0;
/* dealloc the block variables */
processBlockVars (body, &stack, DEALLOCATE);
+ outputDebugStackSymbols();
/* deallocate paramaters */
deallocParms (FUNC_ARGS(name->type));
addSet (&operKeyReset, name);
applyToSet (operKeyReset, resetParmKey);
- if (options.debug)
- cdbStructBlock (1, cdbFile);
+ if (options.debug)
+ cdbStructBlock(1);
cleanUpLevel (LabelTab, 0);
cleanUpBlock (StructTab, 1);
value *args=FUNC_ARGS(tree->left->opval.val->type);
fprintf(outfile,"FUNCTION (%s=%p) type (",
tree->left->opval.val->name, tree);
- printTypeChain (tree->ftype,outfile);
+ printTypeChain (tree->left->opval.val->type->next,outfile);
fprintf(outfile,") args (");
do {
if (arg) {