/*------------------------------------------------------------------*/
/*----------------------------*/
- /* address dereference */
+/* address dereference */
/*----------------------------*/
case '*': /* can be unary : if right is null then unary operation */
if (!tree->right)
TETYPE (tree) = getSpec (TTYPE (tree));
tree->args = tree->left->args;
tree->hasVargs = tree->left->hasVargs;
- SPEC_CONST (TETYPE (tree)) = DCL_PTR_CONST (LTYPE (tree));
+ SPEC_CONST (TETYPE (tree)) = DCL_PTR_CONST (LTYPE(tree));
return tree;
}
tree->opval.val = valUnaryPM (valFromType (LETYPE (tree)));
tree->left = NULL;
TETYPE (tree) = TTYPE (tree) = tree->opval.val->type;
+ SPEC_USIGN(TETYPE(tree)) = 0;
return tree;
}
LRVAL (tree) = 1;
LTYPE (tree));
RRVAL (tree) = 1;
LLVAL (tree) = 1;
- if (!tree->initMode && IS_CONSTANT (LETYPE (tree)))
- werror (E_CODE_WRITE, " ");
-
+ if (!tree->initMode ) {
+ if (IS_CONSTANT (LETYPE (tree))) {
+ werror (E_CODE_WRITE, " ");
+ }
+ }
if (LRVAL (tree))
{
werror (E_LVALUE_REQUIRED, "=");
if (bp->level && bp->level == sym->level && bp->block == sym->block)
return (bp->sym);
/* if levels don't match then we are okay */
- if (bp->level && bp->level != sym->level)
+ if (bp->level && bp->level != sym->level && bp->block <= sym->block)
return (bp->sym);
/* if this is a global variable then we are ok too */
if (bp->level == 0)
fprintf (of, "volatile ");
if (SPEC_USIGN (type))
fprintf (of, "unsigned ");
+ if (SPEC_CONST (type))
+ fprintf (of, "const ");
switch (SPEC_NOUN (type))
{
#define IS_LONG(x) (IS_SPEC(x) && x->select.s._long)
#define IS_SHORT(x) (IS_SPEC(x) && x->select.s._short)
#define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef)
-#define IS_CONSTANT(x) (IS_SPEC(x) && (x->select.s.sclass == S_CONSTANT ||\
- x->select.s._const == 1))
+#define IS_CONSTANT(x) (IS_SPEC(x) && ( x->select.s._const == 1))
#define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT)
#define IS_ABSOLUTE(x) (IS_SPEC(x) && x->select.s._absadr )
#define IS_REGISTER(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_REGISTER)