{
symbol *newSym;
- // this can only be a constant
- if (!inInitMode && !IS_LITERAL(sym->ival->init.node->etype)) {
- werror (E_CONST_EXPECTED);
- }
-
/* insert the symbol into the symbol table */
/* with level = 0 & name = rname */
newSym = copySymbol (sym);
}
-//#define DEMAND_INTEGER_PROMOTION
-
-#ifdef DEMAND_INTEGER_PROMOTION
-
-/*-----------------------------------------------------------------*/
-/* walk a tree looking for the leaves. Add a typecast to the given */
-/* type to each value leaf node. */
-/*-----------------------------------------------------------------*/
-void
-pushTypeCastToLeaves (sym_link * type, ast * node, ast ** parentPtr)
-{
- if (!node || IS_CALLOP(node))
- {
- /* WTF? We should never get here. */
- return;
- }
-
- if (!node->left && !node->right)
- {
- /* We're at a leaf; if it's a value, apply the typecast */
- if (node->type == EX_VALUE && IS_INTEGRAL (TTYPE (node)))
- {
- *parentPtr = decorateType (newNode (CAST,
- newAst_LINK (copyLinkChain (type)),
- node));
- }
- }
- else
- {
- if (node->left)
- {
- pushTypeCastToLeaves (type, node->left, &(node->left));
- }
- if (node->right)
- {
- pushTypeCastToLeaves (type, node->right, &(node->right));
- }
- }
-}
-
-#endif
-
/*-----------------------------------------------------------------*/
/* decorateType - compute type for this tree also does type cheking */
/* this is done bottom up, since type have to flow upwards */
name->lastLine = yylineno;
currFunc = name;
-#if 0 // jwk: this is now done in addDecl()
- processFuncArgs (currFunc);
-#endif
-
/* set the stack pointer */
/* PENDING: check this for the mcs51 */
stackPtr = -port->stack.direction * port->stack.call_overhead;
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
- if (dtype && !IFFUNC_ISNAKED(dtype) &&
+ if (currFunc && dtype && !IFFUNC_ISNAKED(dtype) &&
(FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype)) &&
IFFUNC_ISISR (currFunc->type))
{
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
- if (dtype && !IFFUNC_ISNAKED(dtype) &&
+ if (currFunc && dtype && !IFFUNC_ISNAKED(dtype) &&
IFFUNC_ISISR (currFunc->type) &&
(FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype))) {
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
- if (dtype && !IFFUNC_ISNAKED(dtype) &&
+ if (currFunc && dtype && !IFFUNC_ISNAKED(dtype) &&
(FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype)) &&
IFFUNC_ISISR (currFunc->type))
{
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
- if (dtype && !FUNC_ISNAKED(dtype) &&
+ if (currFunc && dtype && !FUNC_ISNAKED(dtype) &&
IFFUNC_ISISR (currFunc->type) &&
(FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype))) {
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
emitcode ("setb", "ea");
/* if debug then send end of function */
- /* if (options.debug && currFunc) */
if (options.debug && currFunc)
{
_G.debugLine = 1;
if (allocInfo)
printAllocInfo (currFunc, codeOutFile);
/* if debug information required */
- /* if (options.debug && currFunc) { */
if (options.debug && currFunc)
{
cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
}
dtype = operandType(IC_LEFT(ic));
- if (dtype &&
+ if (currFunc && dtype &&
(FUNC_REGBANK(currFunc->type) != FUNC_REGBANK(dtype)) &&
IFFUNC_ISISR(currFunc->type) &&
!ic->bankSaved)
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType(IC_LEFT(ic));
- if (dtype &&
+ if (currFunc && dtype &&
(FUNC_REGBANK(currFunc->type) != FUNC_REGBANK(dtype)) &&
IFFUNC_ISISR(currFunc->type) &&
!ic->bankSaved)
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType(IC_LEFT(ic));
- if (dtype &&
+ if (currFunc && dtype &&
IFFUNC_ISISR(currFunc->type) &&
(FUNC_REGBANK(currFunc->type) != FUNC_REGBANK(dtype)))
saverbank(FUNC_REGBANK(dtype),ic,TRUE);
}
/* if register bank was saved then unsave them */
- if (dtype &&
+ if (currFunc && dtype &&
(FUNC_REGBANK(currFunc->type) != FUNC_REGBANK(dtype)))
unsaverbank(FUNC_REGBANK(dtype),ic,TRUE);
{ E_SYNTAX_ERROR, ERROR_LEVEL_ERROR,
"Syntax error, declaration ignored at '%s'" },
{ E_CONST_EXPECTED, ERROR_LEVEL_ERROR,
- "Constant Expected Found Variable" },
+ "Initializer element is not constant" },
{ E_OUT_OF_MEM, ERROR_LEVEL_ERROR,
"'malloc' failed file '%s' for size %ld" },
{ E_FILE_OPEN_ERR, ERROR_LEVEL_ERROR,