* src/SDCCsymt.c (changePointer, checkDecl, addSymChain): changed
parameter of changePointer() from symbol* to sym_link*
* src/SDCCast.c (decorateType): call changePointer() for CAST op
* src/SDCCsymt.c (compareType): void* type is castable to other
pointers, but not necesarily an exact match.
* src/SDCCicode.c (geniCodeCast): allow void* casting here since it
is no longer blindly treated as an exact match.
* src/SDCCval.c (valCastLiteral): treat missing type as cast to void
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3436
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2004-08-12 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+ * src/SDCCsymt.h,
+ * src/SDCCsymt.c (changePointer, checkDecl, addSymChain): changed
+ parameter of changePointer() from symbol* to sym_link*
+ * src/SDCCast.c (decorateType): call changePointer() for CAST op
+ * src/SDCCsymt.c (compareType): void* type is castable to other
+ pointers, but not necesarily an exact match.
+ * src/SDCCicode.c (geniCodeCast): allow void* casting here since it
+ is no longer blindly treated as an exact match.
+ * src/SDCCval.c (valCastLiteral): treat missing type as cast to void
+
2004-08-12 Slade Rich <slade_rich AT users.sourceforge.net>
* src/pic/glue.c: Added struct initialisation fn printIvalStruct.
}
/* make sure the type is complete and sane */
+ changePointer(LTYPE(tree));
checkTypeSanity(LETYPE(tree), "(cast)");
/* If code memory is read only, then pointers to code memory */
}
}
} else { // from a pointer to a pointer
- if (port->s.gptr_size > port->s.fptr_size /*!TARGET_IS_Z80 && !TARGET_IS_GBZ80*/) {
+ if (IS_GENPTR(type) && IS_VOID(type->next))
+ { // cast to void* is always allowed
+ }
+ else if (IS_GENPTR(optype) && IS_VOID(optype->next))
+ { // cast from void* is always allowed
+ }
+ else if (port->s.gptr_size > port->s.fptr_size /*!TARGET_IS_Z80 && !TARGET_IS_GBZ80*/) {
// if not a pointer to a function
if (!(IS_CODEPTR(type) && IS_FUNC(type->next) && IS_FUNC(optype))) {
if (implicit) { // if not to generic, they have to match
for (; sym != NULL; sym = sym->next)
{
- changePointer(sym);
+ changePointer(sym->type);
checkTypeSanity(sym->etype, sym->name);
if (!sym->level && !(IS_SPEC(sym->etype) && IS_TYPEDEF(sym->etype)))
/* changePointer - change pointer to functions */
/*------------------------------------------------------------------*/
void
-changePointer (symbol * sym)
+changePointer (sym_link * p)
{
- sym_link *p;
/* go thru the chain of declarations */
/* if we find a pointer to a function */
/* unconditionally change it to a ptr */
/* to code area */
- for (p = sym->type; p; p = p->next)
+ for (; p; p = p->next)
{
if (!IS_SPEC (p) && DCL_TYPE (p) == UPOINTER)
DCL_TYPE (p) = port->unqualified_pointer;
{
checkSClass (sym, isProto); /* check the storage class */
- changePointer (sym); /* change pointers if required */
+ changePointer (sym->type); /* change pointers if required */
/* if this is an array without any dimension
then update the dimension from the initial value */
return compareType (dest->next, src->next);
}
if (IS_PTR (dest) && IS_GENPTR (src) && IS_VOID(src->next)) {
- return 1;
+ return -1;
}
if (IS_PTR (src) && IS_GENPTR (dest))
return -1;
void *findSym (bucket **, void *, const char *);
void *findSymWithLevel (bucket **, struct symbol *);
void *findSymWithBlock (bucket **, struct symbol *, int);
-void changePointer (symbol * sym);
+void changePointer (sym_link * p);
void checkTypeSanity(sym_link *etype, char *name);
sym_link *typeFromStr (char *) ;
STORAGE_CLASS sclsFromPtr(sym_link *ptr);
return NULL;
val = newValue ();
- val->etype = getSpec (val->type = copyLinkChain (dtype));
+ if (dtype)
+ val->etype = getSpec (val->type = copyLinkChain (dtype));
+ else
+ {
+ val->etype = val->type = newLink (SPECIFIER);
+ SPEC_NOUN (val->etype) = V_VOID;
+ }
SPEC_SCLS (val->etype) = S_LITERAL;
/* if it is not a specifier then we can assume that */