X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCsymt.c;h=6b856b4380f5c2798910bf4eb8dcdf58cabeb813;hb=fcd3d54ba63617cd807499b410f44ae831e7ba42;hp=e9b76c7d9cd14dd1a8d29fb475f85a0020cc0ed6;hpb=3b687e0be417621a93fd39d2e5fbd9a58a27e9b9;p=fw%2Fsdcc diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index e9b76c7d..6b856b43 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1013,7 +1013,7 @@ addSymChain (symbol * symHead) 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))) @@ -1249,7 +1249,7 @@ compStructSize (int su, structdef * sdef) loop = loop->next; - /* if union then size = sizeof larget field */ + /* if union then size = sizeof largest field */ if (su == UNION) { /* For UNION, round up after each field */ sum += ((bitOffset+7)/8); @@ -1475,6 +1475,7 @@ checkSClass (symbol * sym, int isProto) /* initializers if not an extern */ if (SPEC_SCLS (sym->etype) == S_CODE && sym->ival == NULL && + !sym->_isparm && //!sym->level && port->mem.code_ro && !IS_EXTERN (sym->etype) && @@ -1510,15 +1511,14 @@ checkSClass (symbol * sym, int isProto) /* 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; @@ -1535,7 +1535,7 @@ checkDecl (symbol * sym, int isProto) { 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 */ @@ -1893,7 +1893,7 @@ compareType (sym_link * dest, sym_link * src) 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; @@ -2475,7 +2475,12 @@ processFuncArgs (symbol * func) /* change it to pointer to the same type */ while (val) { - int argreg = 0; + int argreg = 0; + char buffer[SDCC_NAME_MAX+1]; + + SNPRINTF (buffer, sizeof(buffer), "%s parameter %d", func->name, pNum); + checkTypeSanity (val->etype, buffer); + /* mark it as a register parameter if the function does not have VA_ARG and as port dictates */