/*-----------------------------------------------------------------*/
/* constExprValue - returns the value of a constant expression */
+/* or NULL if it is not a constant expression */
/*-----------------------------------------------------------------*/
value *
constExprValue (ast * cexpr, int check)
if (check)
werror (E_CONST_EXPECTED, "found expression");
- return constVal("0");
+ return NULL;
}
/* return the value */
}
fl;
+ if (!val) {
+ // assuming we have been warned before
+ val=constVal("0");
+ }
+
/* if it is a float then it gets tricky */
/* otherwise it is fairly simple */
if (!IS_FLOAT (val->type)) {
segment = SPEC_OCLS (symIval->etype);
deleteSetItem (&segment->syms, symIval);
}
+
sym->ival = NULL;
}
}
}
wrong:
werror (W_INIT_WRONG);
- return constVal("0");
+ return NULL;
}
/* initializers if not an extern */
if (SPEC_SCLS (sym->etype) == S_CODE &&
sym->ival == NULL &&
- !sym->level &&
+ //!sym->level &&
port->mem.code_ro &&
!IS_EXTERN (sym->etype) &&
!funcInChain (sym->type))
return rType;
}
-/*------------------------------------------------------------------*/
-/* compareType - will do type check return 1 if match */
-/*------------------------------------------------------------------*/
+/*--------------------------------------------------------------------*/
+/* compareType - will do type check return 1 if match, -1 if castable */
+/*--------------------------------------------------------------------*/
int
compareType (sym_link * dest, sym_link * src)
{
return -1;
if (SPEC_USIGN (dest) != SPEC_USIGN (src))
- return -2;
+ return -1;
return 1;
}