Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.243
 
1.244
 
MAIN:ragge:20090110145016
 
pftn.c
_>100100         int     rstr;
 101101         struct  symtab *rsym;
 102102         struct  symtab *rb;
<>103 -        struct  suedef *rsue;
  103+        gcc_ap_t *rgap;
104104         int     flags;
 105105 #define LASTELM 1
 106106 } *rpole;
     
 !
608608         symclear(1);    /* In case of function pointer args */
 609609 }
 610610 
<>611 -#ifdef notyet
612611 /*
<>613 - * Copy sue to either perm or tmp memory, depending on blevel.
  612+ * Alloc sue from either perm or tmp memory, depending on blevel.
614613  */
 615614 static struct suedef *
<>616 -suecopy(struct suedef *sue)
  615+sueget(struct suedef *p)
617616 {
<>618 -        struct suedef *r;
  617+        struct suedef *sue;
619618 
<>620 -        r = blevel ? tmpalloc(sizeof(struct suedef)) :
 621 -            permalloc(sizeof(struct suedef));
 622 -        *r = *sue;
 623 -        return r;
  619+        if (blevel == 0) {
  620+                sue = permalloc(sizeof(struct suedef));
  621+                suedefcnt++;
  622+        } else
  623+                sue = tmpalloc(sizeof(struct suedef));
  624+        sue = memset(sue, 0, sizeof(struct suedef));
  625+        sue->suep = p;
  626+        return sue;
624627 }
<>625 -#endif
626628 
 627629 /*
 628630  * Struct/union/enum symtab construction.
     
 !
717719                 sp = hide(sp);
 718720                 defstr(sp, ENAME);
 719721         }
<>720 -        sp->ssue->sylnk = sp;   /* ourselves */
  722+        sp->ssue->suem = sp;    /* ourselves XXX */
721723         return sp;
 722724 }
 723725 
     
 !
727729 NODE *
 728730 enumdcl(struct symtab *sp)
 729731 {
<> 732+        struct suedef *sue;
730733         NODE *p;
 731734         TWORD t;
 732735 
     
 !
742745 #endif
 743746         if (sp) {
 744747                 sp->stype = t;
<>745 -                sp->ssue = MKSUE(t);
 746 -        }
 747 -        p = mkty(t, 0, MKSUE(t));
  748+                sue = sp->ssue;
  749+                sue->suesize = (MKSUE(t))->suesize;
  750+                sue->suealign = (MKSUE(t))->suealign;
  751+        } else
  752+                sue = MKSUE(t);
  753+        p = mkty(t, 0, sue);
748754         p->n_sp = sp;
 749755         return p;
 750756 }
     
 !
785791  * begining of structure or union declaration
 786792  */
 787793 struct rstack *
<>788 -bstruct(char *name, int soru, struct suedef *sue)
  794+bstruct(char *name, int soru, gcc_ap_t *gap)
789795 {
 790796         struct rstack *r;
 791797         struct symtab *sp;
     
 !
806812         r->rsou = soru;
 807813         r->rsym = sp;
 808814         r->rb = NULL;
<>809 -        r->rsue = sue;
  815+        r->rgap = gap;
810816         r->rnext = rpole;
 811817         rpole = r;
 812818 
     
 !
823829  * - If suep->suepacked is set, it will pack all struct members.
 824830  */
 825831 NODE *
<>826 -dclstruct(struct rstack *r, struct suedef *suep)
  832+dclstruct(struct rstack *r)
827833 {
 828834         NODE *n;
 829835         struct suedef *sue;
 830836         struct symtab *sp;
 831837         int al, sa, sz, coff;
<>832 -        struct suedef sues;
833838 
<>834 -        if (suep && r->rsue) { /* merge */
 835 -                if (suep->suealigned == 0)
 836 -                        suep->suealigned = r->rsue->suealigned;
 837 -                if (suep->suepacked == 0)
 838 -                        suep->suepacked = r->rsue->suepacked;
 839 -        } else if (suep == NULL)
 840 -                suep = r->rsue;
 841 -        if (suep == NULL)
 842 -                suep = memset(&sues, 0, sizeof sues);
  839+        sue = r->rsym ? r->rsym->ssue : sueget(NULL);
843840 
<>844 -        if (pragma_allpacked && !suep->suepacked)
 845 -                suep->suepacked = pragma_allpacked;
 846 -
 847 -        if (r->rsym == NULL) {
 848 -                sue = permalloc(sizeof(struct suedef));
 849 -                memset(sue, 0, sizeof(struct suedef));
 850 -                suedefcnt++;
 851 -        } else
 852 -                sue = r->rsym->ssue;
 853 -
854841 #ifdef ALSTRUCT
 855842         al = ALSTRUCT;
 856843 #else
     
 !
862849          * if struct should be packed.
 863850          */
 864851         coff = 0;
<>865 -        sue->sylnk = r->rb;
  852+        sue->suem = r->rb;
866853         for (sp = r->rb; sp; sp = sp->snext) {
 867854                 sa = talign(sp->stype, sp->ssue);
 868855                 if (sp->sclass & FIELD)
 869856                         sz = sp->sclass&FLDSIZ;
 870857                 else
 871858                         sz = tsize(sp->stype, sp->sdf, sp->ssue);
<>872 -                if (suep->suepacked && r->rsou == STNAME) {
 873 -                        sp->soffset = coff;
 874 -                        coff += sz;
 875 -                        rpole->rstr = coff;
 876 -                }
877859                 if (sz > rpole->rstr)
 878860                         rpole->rstr = sz/* for use with unions */
 879861                 /*
 880862                  * set al, the alignment, to the lcm of the alignments
 881863                  * of the members.
 882864                  */
<>883 -                if (suep->suepacked == 0)
 884 -                        SETOFF(al, sa);
  865+                SETOFF(al, sa);
885866         }
 886867 
<>887 -        /* If alignment given is larger that calculated, expand */
 888 -        if (suep->suealigned)
 889 -                SETOFF(al, suep->suealigned);
 890 -
891868         SETOFF(rpole->rstr, al);
 892869 
 893870         sue->suesize = rpole->rstr;
 894871         sue->suealign = al;
<>895 -        sue->suealigned = suep->suealigned;
 896 -        sue->suepacked = suep->suepacked;
897872 
 898873 #ifdef PCC_DEBUG
 899874         if (ddebug) {
     
 !
903878         }
 904879 #endif
 905880 
<>906 -        pragma_packed = pragma_aligned = 0;
 907 -
908881 #ifdef STABS
 909882         if (gflag)
 910883                 stabs_struct(r->rsym, sue);
     
 !
913886 #ifdef PCC_DEBUG
 914887         if (ddebug>1) {
 915888                 printf("\tsize %d align %d link %p\n",
<>916 -                    sue->suesize, sue->suealign, sue->sylnk);
 917 -                for (sp = sue->sylnk; sp != NULL; sp = sp->snext) {
  889+                    sue->suesize, sue->suealign, sue->suem);
  890+                for (sp = sue->suem; sp != NULL; sp = sp->snext) {
918891                         printf("\tmember %s(%p)\n", sp->sname, sp);
 919892                 }
 920893         }
 921894 #endif
 922895 
<> 896+        if (r->rgap) {
  897+                sue = sueget(sue);
  898+                sue->suega = r->rgap;
  899+        }
  900+
923901         rpole = r->rnext;
 924902         n = mkty(r->rsou == STNAME ? STRTY : UNIONTY, 0, sue);
<> 903+        n->n_qual |= 1; /* definition place */
925904         return n;
 926905 }
 927906 
     
 !
972951          * "...such a structure shall not be a member of a structure
 973952          *  or an element of an array."
 974953          */
<>975 -        if (rpole->rsou == STNAME && sp->ssue->sylnk) {
  954+        if (rpole->rsou == STNAME && sp->ssue->suem) {
976955                 struct symtab *lnk;
 977956 
<>978 -                for (lnk = sp->ssue->sylnk; lnk->snext; lnk = lnk->snext)
  957+                for (lnk = sp->ssue->suem; lnk->snext; lnk = lnk->snext)
979958                         ;
 980959                 if (ISARY(lnk->stype) && lnk->sdf->ddim == NOOFFSET)
 981960                         uerror("incomplete struct in struct");
     
 !
15571536 struct typctx {
 15581537         int class, qual, sig, uns, cmplx, err;
 15591538         TWORD type;
<>1560 -        NODE *saved;
  1539+        NODE *saved, *prea, *posta;
15611540 };
 15621541 
 15631542 static void
 15641543 typwalk(NODE *p, void *arg)
 15651544 {
 15661545         struct typctx *tc = arg;
 15671546 
<> 1547+#define cmop(x,y) block(CM, x, y, INT, 0, MKSUE(INT))
15681548         switch (p->n_op) {
<> 1549+        case ATTRIB:
  1550+                if (tc->saved && (tc->saved->n_qual & 1)) {
  1551+                        if (tc->posta == NULL)
  1552+                                tc->posta = p->n_left;
  1553+                        else
  1554+                                tc->posta = cmop(tc->posta, p->n_left);
  1555+                } else {
  1556+                        if (tc->prea == NULL)
  1557+                                tc->prea = p->n_left;
  1558+                        else
  1559+                                tc->prea = cmop(tc->prea, p->n_left);
  1560+                }
  1561+                p->n_left = bcon(0); /* For tfree() */
  1562+                break;
15691563         case CLASS:
 15701564                 if (tc->class)
 15711565                         tc->err = 1; /* max 1 class */
     
 !
16951689         if (funsigned_char && tc.type == CHAR && tc.sig == 0)
 16961690                 tc.type = UCHAR;
 16971691 
<> 1692+#ifdef GCC_COMPAT
  1693+        if (tc.posta) {
  1694+                /* Can only occur for TYPEDEF, STRUCT or UNION */
  1695+                if (tc.saved == NULL)
  1696+                        cerror("typenode");
  1697+                gcc_tcattrfix(tc.saved, tc.posta);
  1698+        }
  1699+        if (tc.prea) {
  1700+#if 0
  1701+                werror("declarator attributes currently unsupported");
  1702+#endif
  1703+                tfree(tc.prea);
  1704+        }
  1705+#endif
16981706         q = (tc.saved ? tc.saved : mkty(tc.type, 0, 0));
 16991707         q->n_qual = tc.qual;
 17001708         q->n_lval = tc.class;
     
 !
17871795                 struct suedef *s = permalloc(sizeof(struct suedef));
 17881796                 *s = *idp->n_sue;
 17891797                 idp->n_sue = s;
<> 1798+#if 0
17901799                 if (sue->suealigned > s->suealign)
 17911800                         s->suealign = sue->suealigned;
 17921801                 s->suepacked = sue->suepacked;
 17931802                 s->suesection = sue->suesection;
<> 1803+#endif
17941804         }
 17951805 #else
 17961806         if (sue) {
     
 !
22262236         /* Check for undefined or late defined enums */
 22272237         if (BTYPE(f->n_type) == ENUMTY) {
 22282238                 /* not-yet check if declared enum */
<>2229 -                if (f->n_sue->sylnk->stype != ENUMTY)
 2230 -                        MODTYPE(f->n_type, f->n_sue->sylnk->stype);
  2239+                if (f->n_sue->suem->stype != ENUMTY)
  2240+                        MODTYPE(f->n_type, f->n_sue->suem->stype);
22312241                 if (BTYPE(f->n_type) == ENUMTY)
<>2232 -                        uerror("enum %s not declared", f->n_sue->sylnk->sname);
  2242+                        uerror("enum %s not declared", f->n_sue->suem->sname);
22332243         }
 22342244 
 22352245         /*
     
 !
23462356                                         MKTY(apole->node, arrt, 0, 0)
 23472357                                 }
 23482358                         } else if (ISSOU(BTYPE(type))) {
<>2349 -                                if (apole->node->n_sue->sylnk != al[1].sue->sylnk)
  2359+                                if (apole->node->n_sue->suem != al[1].sue->suem)
23502360                                         goto incomp;
 23512361                         }
 23522362                         goto out;
     
 !
23662376                 /* Check for struct/union compatibility */
 23672377                 if (type == arrt) {
 23682378                         if (ISSOU(BTYPE(type))) {
<>2369 -                                if (apole->node->n_sue->sylnk == al[1].sue->sylnk)
  2379+                                if (apole->node->n_sue->suem == al[1].sue->suem)
23702380                                         goto out;
 23712381                         } else
 23722382                                 goto out;
     
 !
24912501                 t2 = usym->type;
 24922502                 if (ISSTR(ty)) {
 24932503                         usym++, udef++;
<>2494 -                        if (usym->sue->sylnk != udef->sue->sylnk)
  2504+                        if (usym->sue->suem != udef->sue->suem)
24952505                                 return 1;
 24962506                 }
 24972507 
     
 !
25162526         int mod1, mod2;
 25172527         /* fix up the types, and check for legality */
 25182528 
<> 2529+        /* forward declared enums */
  2530+        if (BTYPE(p->n_sp->stype) == ENUMTY)
  2531+                MODTYPE(p->n_sp->stype, p->n_sp->ssue->suem->stype);
  2532+
<_25192533         if( (type = p->n_type) == UNDEF ) return;
 25202534         if ((mod2 = (type&TMASK))) {
 25212535                 t = DECREF(type);
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-18 08:26 +0100