Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.20
 
1.21
 
MAIN:ragge:20030108221549
 
pftn.c
_>471471         paramno = 0;
 472472 }
 473473 
<> 474+/*
  475+ * reference to a structure or union, with no definition
  476+ */
474477 NODE *
<>475 -rstruct( idn, soru ){ /* reference to a structure or union, with no definition */
  478+rstruct(int idn, int soru)
  479+{
476480         struct symtab *p;
 477481         NODE *q;
 478482         p = &stab[idn];
<>479 -        switch( p->stype ){
  483+        switch (p->stype) {
480484 
 481485         case UNDEF:
 482486         def:
<>483 -                q = block( FREE, NIL, NIL, 0, 0, 0 );
  487+                q = block(FREE, NIL, NIL, 0, 0, 0);
484488                 q->tn.rval = idn;
<>485 -                q->in.type = (soru&INSTRUCT) ? STRTY : ( (soru&INUNION) ? UNIONTY : ENUMTY );
 486 -                defid( q, (soru&INSTRUCT) ? STNAME : ( (soru&INUNION) ? UNAME : ENAME ) );
  489+                q->in.type = (soru&INSTRUCT) ? STRTY :
  490+                    ((soru&INUNION) ? UNIONTY : ENUMTY);
  491+                defid(q, (soru&INSTRUCT) ? STNAME :
  492+                    ((soru&INUNION) ? UNAME : ENAME));
487493                 break;
 488494 
 489495         case STRTY:
<>490 -                if( soru & INSTRUCT ) break;
  496+                if (soru & INSTRUCT)
  497+                        break;
491498                 goto def;
 492499 
 493500         case UNIONTY:
<>494 -                if( soru & INUNION ) break;
  501+                if (soru & INUNION)
  502+                        break;
495503                 goto def;
 496504 
 497505         case ENUMTY:
<>498 -                if( !(soru&(INUNION|INSTRUCT)) ) break;
  506+                if (!(soru&(INUNION|INSTRUCT)))
  507+                        break;
499508                 goto def;
 500509 
<>501 -                }
 502 -        stwart = instruct;
 503 -        return( mkty( p->stype, 0, p->sizoff ) );
504510         }
<> 511+        stwart = instruct;
  512+        return(mkty(p->stype, 0, p->sizoff));
  513+}
505514 
 506515 void
 507516 moedef(int idn)
     
 !
526535         psave(strucoff);
 527536         strucoff = 0;
 528537         instruct = soru;
<>529 -        q = block( FREE, NIL, NIL, 0, 0, 0 );
  538+        q = block(FREE, NIL, NIL, 0, 0, 0);
530539         q->tn.rval = idn;
<>531 -        if( instruct==INSTRUCT ){
  540+        if (instruct==INSTRUCT) {
532541                 strunem = MOS;
 533542                 q->in.type = STRTY;
<>534 -                if( idn >= 0 ) defid( q, STNAME );
 535 -                }
 536 -        else if( instruct == INUNION ) {
  543+                if (idn >= 0)
  544+                        defid(q, STNAME);
  545+        } else if(instruct == INUNION) {
537546                 strunem = MOU;
 538547                 q->in.type = UNIONTY;
<>539 -                if( idn >= 0 ) defid( q, UNAME );
 540 -                }
 541 -        else { /* enum */
  548+                if (idn >= 0)
  549+                        defid(q, UNAME);
  550+        } else { /* enum */
542551                 strunem = MOE;
 543552                 q->in.type = ENUMTY;
<>544 -                if( idn >= 0 ) defid( q, ENAME );
 545 -                }
 546 -        psave( idn = q->tn.rval );
  553+                if (idn >= 0)
  554+                        defid(q, ENAME);
  555+        }
  556+        psave(idn = q->tn.rval);
547557         /* the "real" definition is where the members are seen */
<>548 -        if ( idn >= 0 ) stab[idn].suse = lineno;
 549 -        return( paramno-4 );
  558+        if (idn >= 0)
  559+                stab[idn].suse = lineno;
  560+        return(paramno-4);
550561 }
 551562 
 552563 /*
     
 !
605616                         continue;
 606617                         }
 607618                 sa = talign( p->stype, p->sizoff );
<>608 -                if( p->sclass & FIELD ){
  619+                if (p->sclass & FIELD) {
609620                         sz = p->sclass&FLDSIZ;
<>610 -                        }
 611 -                else {
 612 -                        sz = tsize( p->stype, p->dimoff, p->sizoff );
 613 -                        }
 614 -                if( sz == 0 ){
 615 -                        werror( "illegal zero sized structure member: %s", p->sname );
 616 -                        }
 617 -                if( sz > strucoff ) strucoff = sz;  /* for use with unions */
 618 -                SETOFF( al, sa );
 619 -                /* set al, the alignment, to the lcm of the alignments of the members */
  621+                } else {
  622+                        sz = tsize(p->stype, p->dimoff, p->sizoff);
620623                 }
<>621 -        dstash( -1 );  /* endmarker */
  624+#if 0
  625+                if (sz == 0) {
  626+                        werror("illegal zero sized structure member: %s", p->sname );
  627+                }
  628+#endif
  629+                if (sz > strucoff)
  630+                        strucoff = sz/* for use with unions */
  631+                /*
  632+                 * set al, the alignment, to the lcm of the alignments
  633+                 * of the members.
  634+                 */
  635+                SETOFF(al, sa);
  636+        }
  637+        dstash(-1);  /* endmarker */
622638         SETOFF( strucoff, al );
 623639 
 624640         if( temp == ENUMTY ){
     
 !
633649 #endif
 634650                 strucoff = tsize( ty, 0, (int)ty );
 635651                 dimtab[ szindex+2 ] = al = talign( ty, (int)ty );
<>636 -                }
  652+        }
637653 
<>638 -        if( strucoff == 0 ) uerror( "zero sized structure" );
 639 -        dimtab[ szindex ] = strucoff;
 640 -        dimtab[ szindex+2 ] = al;
 641 -        dimtab[ szindex+3 ] = paramstk[ oparam+3 ];  /* name index */
  654+#if 0
  655+        if (strucoff == 0)
  656+                uerror( "zero sized structure" );
  657+#endif
  658+        dimtab[szindex] = strucoff;
  659+        dimtab[szindex+2] = al;
  660+        dimtab[szindex+3] = paramstk[ oparam+3 ];  /* name index */
642661 
<>643 -        FIXSTRUCT( szindex, oparam ); /* local hook, eg. for sym debugger */
  662+        FIXSTRUCT(szindex, oparam); /* local hook, eg. for sym debugger */
644663 # ifndef BUG1
<>645 -        if( ddebug>1 ){
 646 -                printf( "\tdimtab[%d,%d,%d] = %d,%d,%d\n", szindex,szindex+1,szindex+2,
 647 -                                dimtab[szindex],dimtab[szindex+1],dimtab[szindex+2] );
 648 -                for( i = dimtab[szindex+1]; dimtab[i] >= 0; ++i ){
 649 -                        printf( "\tmember %s(%d)\n", stab[dimtab[i]].sname, dimtab[i] );
 650 -                        }
  664+        if (ddebug>1) {
  665+                printf("\tdimtab[%d,%d,%d] = %d,%d,%d\n",
  666+                    szindex,szindex+1,szindex+2,
  667+                    dimtab[szindex],dimtab[szindex+1],dimtab[szindex+2] );
  668+                for (i = dimtab[szindex+1]; dimtab[i] >= 0; ++i) {
  669+                        printf("\tmember %s(%d)\n",
  670+                            stab[dimtab[i]].sname, dimtab[i]);
651671                 }
<> 672+        }
652673 # endif
 653674 
 654675         strucoff = paramstk[ oparam+2 ];
 655676         paramno = oparam;
 656677 
 657678         return( mkty( temp, 0, szindex ) );
<>658 -        }
  679+}
659680 
 660681 /*
 661682  * error printing routine in parser
     
 !
785806                         }
 786807                 }
 787808 
<>788 -        if( dimtab[s]==0 ) {
 789 -                if( ty == STRTY )
 790 -                        uerror( "undefined structure" );
 791 -                else
 792 -                        uerror( "unknown size");
 793 -                return( SZINT );
  809+        if (ty != STRTY && ty != UNIONTY) {
  810+                if (dimtab[s] == 0) {
  811+                        uerror("unknown size");
  812+                        return(SZINT);
794813                 }
<>795 -        return( (unsigned int) dimtab[ s ] * mult );
  814+        } else {
  815+                if (dimtab[s+1] == -1)
  816+                        uerror("unknown structure/union");
796817         }
 797818 
<> 819+        return( (unsigned int) dimtab[ s ] * mult );
  820+}
  821+
<_798822 /*
 799823  * force inoff to have the value n
 800824  */
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-09-02 21:09 +0200