ex = Safe_alloc ( sizeof (ast));
ex->type = type;
- ex->lineno = (noLineno ? oldLineno : yylineno);
+ ex->lineno = (noLineno ? oldLineno : mylineno);
ex->filename = currFname;
ex->level = NestLevel;
ex->block = currBlockno;
return ex;
}
-ast *
-newAst_STMNT (unsigned val)
-{
- ast *ex = newAst_ (EX_STMNT);
- ex->opval.stmnt = val;
- return ex;
-}
-
/*-----------------------------------------------------------------*/
/* newNode - creates a new node */
/*-----------------------------------------------------------------*/
if (constExprTree(cexpr->left) && constExprTree(cexpr->right)) {
return TRUE;
}
+ return FALSE;
+ case EX_OPERAND:
+ return IS_CONSTANT(operandType(cexpr->opval.oprnd));
}
return FALSE;
-}
+}
/*-----------------------------------------------------------------*/
/* constExprValue - returns the value of a constant expression */
if (IS_AST_OP(tree) &&
(tree->opval.op == CAST || tree->opval.op == '=') &&
(getSize(LTYPE(tree)) > getSize(RTYPE(tree))) &&
- (getSize(RTYPE(tree)) < INTSIZE)) {
+ (getSize(RTYPE(tree)) < (unsigned) INTSIZE)) {
// this is a cast/assign to a bigger type
if (IS_AST_OP(tree->right) &&
IS_INTEGRAL(tree->right->ftype) &&
tree->right = NULL;
TTYPE (tree) = tree->opval.val->type;
tree->values.literalFromCast = 1;
- } else if (IS_GENPTR(LTYPE(tree)) && !IS_PTR(RTYPE(tree)) &&
+ } else if (IS_GENPTR(LTYPE(tree)) && !IS_PTR(RTYPE(tree)) &&
((int)floatFromVal(valFromType(RETYPE(tree)))) !=0 ) /* special case of NULL */ {
sym_link *rest = LTYPE(tree)->next;
- werror(W_LITERAL_GENERIC);
+ werror(W_LITERAL_GENERIC);
TTYPE(tree) = newLink(DECLARATOR);
DCL_TYPE(TTYPE(tree)) = FPOINTER;
TTYPE(tree)->next = rest;
/* if pointer to struct then check names */
if (IS_PTR(LTYPE(tree)) && IS_STRUCT(LTYPE(tree)->next) &&
IS_PTR(RTYPE(tree)) && IS_STRUCT(RTYPE(tree)->next) &&
- strcmp(SPEC_STRUCT(LETYPE(tree))->tag,SPEC_STRUCT(RETYPE(tree))->tag))
+ strcmp(SPEC_STRUCT(LETYPE(tree))->tag,SPEC_STRUCT(RETYPE(tree))->tag))
{
werror(W_CAST_STRUCT_PTR,SPEC_STRUCT(RETYPE(tree))->tag,
SPEC_STRUCT(LETYPE(tree))->tag);
case V_STRUCT:
typeofv = TYPEOF_STRUCT;
break;
+ case V_BITFIELD:
+ typeofv = TYPEOF_BITFIELD;
+ break;
case V_BIT:
typeofv = TYPEOF_BIT;
break;
{
werror (E_TYPE_MISMATCH, "assignment", " ");
printFromToType(RTYPE(tree),LTYPE(tree));
- //goto errorTreeReturn;
}
/* if the left side of the tree is of type void
if ((options.stackAuto || IFFUNC_ISREENT (LTYPE (tree))) &&
!IFFUNC_ISBUILTIN(LTYPE(tree)))
{
- //FUNC_ARGS(tree->left->ftype) =
- //reverseVal (FUNC_ARGS(tree->left->ftype));
reverseParms (tree->right);
}
- TETYPE (tree) = getSpec (TTYPE (tree) = LTYPE (tree)->next);
+ if (IS_CODEPTR(LTYPE(tree))) {
+ TTYPE(tree) = LTYPE(tree)->next->next;
+ } else {
+ TTYPE(tree) = LTYPE(tree)->next;
+ }
+ TETYPE (tree) = getSpec (TTYPE (tree));
return tree;
/*------------------------------------------------------------------*/
if (!IS_VOID (currFunc->type->next) && tree->right == NULL)
{
- werror (E_VOID_FUNC, currFunc->name);
+ werror (W_VOID_FUNC, currFunc->name);
goto errorTreeReturn;
}
addSymChain (name);
allocVariables (name);
}
- name->lastLine = yylineno;
+ name->lastLine = mylineno;
currFunc = name;
/* set the stack pointer */
/* just get the type */
if (tree->type == EX_VALUE) {
- if (IS_LITERAL (tree->opval.val->etype)) {
- fprintf(outfile,"CONSTANT (%p) value = %d, 0x%x, %g", tree,
- (int) floatFromVal(tree->opval.val),
- (int) floatFromVal(tree->opval.val),
- floatFromVal(tree->opval.val));
+ if (IS_LITERAL (tree->opval.val->etype)) {
+ fprintf(outfile,"CONSTANT (%p) value = ", tree);
+ if (SPEC_USIGN (tree->opval.val->etype))
+ fprintf(outfile,"%u", (TYPE_UDWORD) floatFromVal(tree->opval.val));
+ else
+ fprintf(outfile,"%d", (TYPE_DWORD) floatFromVal(tree->opval.val));
+ fprintf(outfile,", 0x%x, %g", (TYPE_UDWORD) floatFromVal(tree->opval.val),
+ floatFromVal(tree->opval.val));
} else if (tree->opval.val->sym) {
/* if the undefined flag is set then give error message */
if (tree->opval.val->sym->undefined) {