X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCsymt.c;h=0dce6fa4a2e08e20d43c8aa840aef4182c3691fa;hb=9a41b4db10ee40ac3a381f4dbbfd3cc2fa9014a6;hp=48f967919af18a7b616638d2019aa2eadd61adff;hpb=f0be1f29144f92632436c652a47b7f29dcefb86a;p=fw%2Fsdcc diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 48f96791..0dce6fa4 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -347,8 +347,6 @@ pointerTypes (sym_link * ptr, sym_link * type) storage class of the type */ if (IS_SPEC (type)) { - DCL_PTR_CONST (ptr) = SPEC_CONST (type); - DCL_PTR_VOLATILE (ptr) = SPEC_VOLATILE (type); switch (SPEC_SCLS (type)) { case S_XDATA: @@ -364,7 +362,6 @@ pointerTypes (sym_link * ptr, sym_link * type) DCL_TYPE (ptr) = POINTER; break; case S_CODE: - DCL_PTR_CONST (ptr) = port->mem.code_ro; DCL_TYPE (ptr) = CPOINTER; break; case S_EEPROM: @@ -457,22 +454,26 @@ addDecl (symbol * sym, int type, sym_link * p) } /* if the type is an unknown pointer and has - a tspec then take the storage class const & volatile + a tspec then take the const & volatile attribute from the tspec & make it those of this symbol */ + if (p && - !IS_SPEC (p) && - //DCL_TYPE (p) == UPOINTER && + IS_DECL (p) && + DCL_TYPE (p) == UPOINTER && DCL_TSPEC (p)) { + // only for declarators + wassert (IS_DECL(sym->type)); + if (!IS_SPEC (sym->etype)) { sym->etype = sym->etype->next = newLink (); sym->etype->class = SPECIFIER; } - SPEC_SCLS (sym->etype) = SPEC_SCLS (DCL_TSPEC (p)); - SPEC_CONST (sym->etype) = SPEC_CONST (DCL_TSPEC (p)); - SPEC_VOLATILE (sym->etype) = SPEC_VOLATILE (DCL_TSPEC (p)); + + DCL_PTR_CONST (sym->type) = SPEC_CONST (DCL_TSPEC (p)); + DCL_PTR_VOLATILE (sym->type) = SPEC_VOLATILE (DCL_TSPEC (p)); DCL_TSPEC (p) = NULL; } @@ -645,23 +646,6 @@ mergeSpec (sym_link * dest, sym_link * src, char *name) return symlink; } -/*------------------------------------------------------------------*/ -/* cloneSpec - copies the entire spec and returns a new spec */ -/*------------------------------------------------------------------*/ -sym_link * -cloneSpec (sym_link * src) -{ - sym_link *spec; - - /* go thru chain till we find the specifier */ - while (src && src->class != SPECIFIER) - src = src->next; - - spec = newLink (); - memcpy (spec, src, sizeof (sym_link)); - return spec; -} - /*------------------------------------------------------------------*/ /* genSymName - generates and returns a name used for anonymous vars */ /*------------------------------------------------------------------*/ @@ -2113,12 +2097,12 @@ printTypeChain (sym_link * start, FILE * of) break; } } - /* search entry in list before "type" */ - for (search = start; search && search->next != type;) - search = search->next; - type = search; - if (type) - fputc (' ', of); + /* search entry in list before "type" */ + for (search = start; search && search->next != type;) + search = search->next; + type = search; + if (type) + fputc (' ', of); } if (nlr) fprintf (of, "\n");