From: sandeep Date: Tue, 14 Nov 2000 00:56:09 +0000 (+0000) Subject: more bitfield related fixes X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=157c83d1fa00703ceeef06e35e5e4c72c965f93b;p=fw%2Fsdcc more bitfield related fixes git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@499 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index e2780d51..f3980ed4 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -786,7 +786,9 @@ int funcInChain (link *lnk) link *structElemType (link *stype, value *id ,value **argsp) { symbol *fields = (SPEC_STRUCT(stype) ? SPEC_STRUCT(stype)->fields : NULL); - + link *type, *etype; + link *petype = getSpec(stype); + if ( ! fields || ! id) return NULL ; @@ -796,7 +798,10 @@ link *structElemType (link *stype, value *id ,value **argsp) if (argsp) { *argsp = fields->args; } - return copyLinkChain (fields->type) ; + type = copyLinkChain (fields->type) ; + etype=getSpec(type); + SPEC_SCLS(etype) = SPEC_SCLS(petype); + return type; } fields = fields->next ; } @@ -833,6 +838,7 @@ int compStructSize (int su, structdef *sdef ) /* for the identifiers */ loop = sdef->fields ; while ( loop ) { + int pbvar =0; /* create the internal name for this variable */ sprintf (loop->rname,"_%s",loop->name); @@ -875,9 +881,13 @@ int compStructSize (int su, structdef *sdef ) if (funcInChain(loop->type)) { processFuncArgs (loop, 1); } - + pbvar = loop->bitVar; loop = loop->next ; - + /* if this is a bitvar & the previous one was not */ + if (loop && loop->bitVar && pbvar == 0) { + bitOffset = 0; + sum++; + } /* if this is not a bitfield but the */ /* previous one was and did not take */ /* the whole byte then pad the rest */