Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.236
 
1.237
 
MAIN:ragge:20081210165431
 
pftn.c
_>799799 
 800800 /*
 801801  * Called after a struct is declared to restore the environment.
<> 802+ * Alignment and packing are handled here.
  803+ * - If ALSTRUCT is defined, this will be the struct alignment and the
  804+ *   struct size will be a multiple of ALSTRUCT, otherwise it will use
  805+ *   the alignment of the largest struct member.
  806+ * - If suep->suealigned is set, then it will specify the alignment.
  807+ * - If suep->suepacked is set, it will pack all struct members.
802808  */
 803809 NODE *
 804810 dclstruct(struct rstack *r, struct suedef *suep)
     
 !
807813         struct suedef *sue;
 808814         struct symtab *sp;
 809815         int al, sa, sz, coff;
<>810 -        TWORD temp;
811816 
 812817         if (pragma_allpacked && !suep->suepacked)
 813818                 suep->suepacked = pragma_allpacked;
     
 !
818823                 suedefcnt++;
 819824         } else
 820825                 sue = r->rsym->ssue;
<>821 -#ifndef ALSTRUCT
 822 -        if (sue->suealign != 0)
 823 -                cerror("dclstruct");
 824 -        /* Calculate largest alignment of struct elements */
 825 -        /* Should be combined with the stuff below */
 826 -        for (al = 1, sp = r->rb; sp; sp = sp->snext)
 827 -                if ((sa = talign(sp->stype, sp->ssue)) > al)
 828 -                        al = sa;
 829 -        sue->suealign = al;
 830 -#else
 831 -        if (sue->suealign == 0)  /* suealign == 0 is undeclared struct */
 832 -                sue->suealign = ALSTRUCT;
  826+
  827+#ifdef ALSTRUCT
833828         al = ALSTRUCT;
<> 829+#else
  830+        al = ALCHAR;
834831 #endif
 835832 
<>836 -        temp = r->rsou == STNAME ? STRTY : UNIONTY;
 837 -
  833+        /*
  834+         * extract size and alignment, recalculate offsets
  835+         * if struct should be packed.
  836+         */
838837         coff = 0;
<>839 -        if (suep->suealigned || suep->suepacked)
 840 -                rpole->rstr = 0; /* must recount it */
 841 -
842838         sue->sylnk = r->rb;
 843839         for (sp = r->rb; sp; sp = sp->snext) {
 844840                 sa = talign(sp->stype, sp->ssue);
 845841                 if (sp->sclass & FIELD)
 846842                         sz = sp->sclass&FLDSIZ;
 847843                 else
 848844                         sz = tsize(sp->stype, sp->sdf, sp->ssue);
<>849 -
 850 -                if ((suep->suepacked || suep->suealigned) && temp == STRTY) {
 851 -                        /* XXX check pack/align sizes */
  845+                if (suep->suepacked && r->rsou == STNAME) {
852846                         sp->soffset = coff;
<>853 -                        if (suep->suealigned)
 854 -                                coff += ALLDOUBLE;
 855 -                        else
 856 -                                coff += sz;
  847+                        coff += sz;
857848                         rpole->rstr = coff;
 858849                 }
<>859 -
860850                 if (sz > rpole->rstr)
 861851                         rpole->rstr = sz/* for use with unions */
 862852                 /*
     
 !
866856                 SETOFF(al, sa);
 867857         }
 868858 
<>869 -        if (!suep->suepacked && !suep->suealigned)
  859+        /* If alignment given is larger that calculated, expand */
  860+        if (suep->suealigned)
  861+                SETOFF(al, suep->suealigned);
  862+
  863+        if (!suep->suepacked)
870864                 SETOFF(rpole->rstr, al);
 871865 
 872866         sue->suesize = rpole->rstr;
 873867         sue->suealign = al;
<> 868+        sue->suealigned = suep->suealigned;
  869+        sue->suepacked = suep->suepacked;
874870 
 875871 #ifdef PCC_DEBUG
 876872         if (ddebug) {
     
 !
898894 #endif
 899895 
 900896         rpole = r->rnext;
<>901 -        n = mkty(temp, 0, sue);
  897+        n = mkty(r->rsou == STNAME ? STRTY : UNIONTY, 0, sue);
<_902898         return n;
 903899 }
 904900 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-31 14:35 +0100