Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.1
 
1.2
 
MAIN:ragge:20020325225236
 
trees.c
_>1 -#ifndef lint
  1+#if 0
22 static char *sccsid ="@(#)trees.c       4.37 (Berkeley) 6/18/90";
 33 #endif
 44 
     
 !
88 
 99 int bdebug = 0;
 1010 int adebug = 0;
<>11 -extern ddebug;
 12 -extern eprint();
  11+extern int ddebug;
1312 
<>14 -            /* corrections when in violation of lint */
  13+void chkpun(NODE *p);
  14+int opact(NODE *p);
  15+int chkstr(int, int, TWORD);
  16+int moditype(TWORD);
1517 
<> 18+/* corrections when in violation of lint */
  19+
1620 /*      some special actions, used in finding the type of nodes */
 1721 # define NCVT 01
 1822 # define PUN 02
     
 !
2832 # define NCVTR 010000
 2933 
 3034 #ifndef BUG1
<>31 -printact(t, acts)
 32 -        NODE *t;
 33 -        int acts;
  35+static void
  36+printact(NODE *t, int acts)
3437 {
 3538         static struct actions {
 3639                 int     a_bit;
     
 !
8184         */
 8285 
 8386 NODE *
<>84 -buildtree( o, l, r ) register NODE *l, *r; {
 85 -        register NODE *p, *q;
 86 -        register actions;
 87 -        register opty;
 88 -        register struct symtab *sp;
 89 -        register NODE *lr, *ll;
 90 -        NODE *fixargs();
  87+buildtree(int o, NODE *l, NODE *r)
  88+{
  89+        NODE *p, *q;
  90+        int actions;
  91+        int opty;
  92+        struct symtab *sp;
  93+        NODE *lr, *ll;
9194         int i;
 9295 
 9396 # ifndef BUG1
<>94 -        if( bdebug ) printf( "buildtree( %s, %o, %o )\n", opst[o], l, r );
  97+        if (bdebug)
  98+                printf("buildtree(%s, %p, %p)\n", opst[o], l, r);
9599 # endif
 96100         opty = optype(o);
 97101 
     
 !
418422                                                 stab[i].sname);
 419423                                 }
 420424                         else {
<>421 -                                register j;
  425+                                int j;
422426                                 if( l->in.type != PTR+STRTY && l->in.type != PTR+UNIONTY ){
 423427                                         if( stab[i].sflags & SNONUNIQ ){
 424428                                                 uerror( "nonunique name demands struct/union or struct/union pointer" );
     
 !
483487                                  * back to PLUS/MINUS REG ICON
 484488                                  * according to local conventions
 485489                                  */
<>486 -                                {
 487 -                                extern NODE * addroreg();
488490                                 p->in.op = FREE;
 489491                                 p = addroreg( l );
<>490 -                                }
491492                                 break;
 492493 
 493494 # endif
     
 !
516517                 case CAST:
 517518                         /* structure assignment */
 518519                         /* take the addresses of the two sides; then make an
<>519 -                        /* operator using STASG and
 520 -                        /* the addresses of left and right */
  520+                         * operator using STASG and
  521+                         * the addresses of left and right */
521522 
 522523                         {
<>523 -                                register TWORD t;
 524 -                                register d, s;
  524+                                TWORD t;
  525+                                int d, s;
525526 
 526527                                 if( l->fn.csiz != r->fn.csiz ) uerror( "assignment of different structures" );
 527528 
     
 !
594595 int fpe_count = -1;
 595596 jmp_buf gotfpe;
 596597 
<> 598+void fpe(int);
597599 void
<>598 -fpe() {
  600+fpe(int a)
  601+{
599602         if (fpe_count < 0)
 600603                 cerror("floating point exception");
 601604         ++fpe_count;
 602605         longjmp(gotfpe, 1);
<>603 -        }
  606+}
604607 
 605608 /*
 606609  * Rewrite arguments in a function call.
     
 !
626629         else if( o == FCON )
 627630                 p = makety(p, DOUBLE, 0, 0);
 628631         return( p );
<>629 -        }
  632+}
630633 
<>631 -chkstr( i, j, type ) TWORD type; {
 632 -        /* is the MOS or MOU at stab[i] OK for strict reference by a ptr */
 633 -        /* i has been checked to contain a MOS or MOU */
 634 -        /* j is the index in dimtab of the members... */
  634+/*
  635+ * is the MOS or MOU at stab[i] OK for strict reference by a ptr
  636+ * i has been checked to contain a MOS or MOU
  637+ * j is the index in dimtab of the members...
  638+ */
  639+int
  640+chkstr(int i, int j, TWORD type)
  641+{
635642         int k, kk;
 636643 
 637644         extern int ddebug;
     
 !
671678                         }
 672679                 }
 673680         return( 0 );
<>674 -        }
  681+}
675682 
<>676 -conval( p, o, q ) register NODE *p, *q; {
 677 -        /* apply the op o to the lval part of p; if binary, rhs is val */
 678 -        /* works only on integer constants */
 679 -        NODE *r;
  683+/*
  684+ * apply the op o to the lval part of p; if binary, rhs is val
  685+ * works only on integer constants
  686+ */
  687+int
  688+conval(NODE *p, int o, NODE *q)
  689+{
680690         int i, u;
 681691         CONSZ val;
 682692         TWORD utype;
     
 !
789799         return(1);
 790800         }
 791801 
<> 802+void
792803 chkpun(p) register NODE *p; {
 793804 
 794805         /* checks p for the existance of a pun */
     
 !
802813         /* in the case of ASSIGN, any assignment of pointer to integer is illegal */
 803814         /* this falls out, because the LHS is never 0 */
 804815 
<>805 -        register NODE *q;
 806 -        register t1, t2;
 807 -        register d1, d2;
 808 -        int ref1, ref2;
  816+        NODE *q;
  817+        int t1, t2, d1, d2, ref1, ref2;
809818 
 810819         t1 = p->in.left->in.type;
 811820         t2 = p->in.right->in.type;
     
 !
913922         return( clocal(p) );
 914923         }
 915924 
<> 925+int
916926 notlval(p) register NODE *p; {
 917927 
 918928         /* return 0 if p an lvalue, 1 otherwise */
     
 !
9951005         }
 9961006 
 9971007 #ifndef econvert
<> 1008+void
9981009 econvert( p ) register NODE *p; {
 9991010 
 10001011         /* change enums to ints, or appropriate types */
     
 !
11381149                 if either operand is unsigned, the result is...
 11391150         */
 11401151 
<>1141 -        register TWORD t1, t2, t, tu;
 1142 -        register o, u;
  1152+        TWORD t1, t2, t, tu;
  1153+        int o, u;
11431154 
 11441155         o = p->in.op;
 11451156 
     
 !
11901201         if( (t != t1 || (u && !ISUNSIGNED(p->in.left->in.type))) && ! asgop(o) )
 11911202                 p->in.left = makety( p->in.left, tu, 0, (int)tu );
 11921203 
<>1193 -        if( t != t2 || (u && !ISUNSIGNED(p->in.right->in.type)) || o==CAST)
  1204+        if( t != t2 || (u && !ISUNSIGNED(p->in.right->in.type)) || o==CAST) {
11941205                 if ( tu == ENUMTY ) {/* always asgop */
 11951206                         p->in.right = makety( p->in.right, INT, 0, INT );
 11961207                         p->in.right->in.type = tu;
     
 !
11991210                         }
 12001211                 else
 12011212                         p->in.right = makety( p->in.right, tu, 0, (int)tu );
<> 1213+        }
12021214 
 12031215         if( asgop(o) ){
 12041216                 p->in.type = p->in.left->in.type;
     
 !
12121224                 }
 12131225 
 12141226 # ifndef BUG1
<>1215 -        if( tdebug ) printf( "tymatch(%o): %o %s %o => %o\n",p,t1,opst[o],t2,tu );
  1227+        if (tdebug)
  1228+                printf("tymatch(%p): %o %s %o => %o\n",p,t1,opst[o],t2,tu );
12161229 # endif
 12171230 
 12181231         return(p);
     
 !
12981311         return(p);
 12991312         }
 13001313 
<> 1314+int
13011315 icons(p) register NODE *p; {
 13021316         /* if p is an integer constant, return its value */
 13031317         int val;
     
 !
13121326                 }
 13131327         tfree( p );
 13141328         return(val);
<>1315 -        }
  1329+}
13161330 
 13171331 /*      the intent of this table is to examine the
 13181332         operators, and to check them for
     
 !
13491363 # define MENU 040 /* enumeration variable or member */
 13501364 # define MVOID 0100000 /* void type */
 13511365 
<> 1366+int
13521367 opact( pNODE *p; {
 13531368 
<>1354 -        register mt12, mt1, mt2, o;
  1369+        int mt12, mt1, mt2, o;
13551370 
 13561371         mt1 = mt2 = mt12 = 0;
 13571372 
     
 !
15201535         return( NCVT );
 15211536         }
 15221537 
<> 1538+int
15231539 moditype( ty ) TWORD ty; {
 15241540 
 15251541         switch( ty ){
     
 !
15671583         }
 15681584 
 15691585 # ifndef BUG2
<> 1586+int
15701587 eprint( p, down, a, b ) register NODE *p; int *a, *b; {
<>1571 -        register ty;
  1588+        int ty;
15721589 
 15731590         *a = *b = down+1;
 15741591         while( down > 1 ){
     
 !
15791596 
 15801597         ty = optype( p->in.op );
 15811598 
<>1582 -        printf("%o) %s, ", p, opst[p->in.op] );
  1599+        printf("%p) %s, ", p, opst[p->in.op] );
15831600         if( ty == LTYPE ){
 15841601                 printf( CONFMT, p->tn.lval );
 15851602                 printf( ", %d, ", p->tn.rval );
 15861603                 }
 15871604         tprint( p->in.type );
 15881605         printf( ", %d, %d\n", p->fn.cdim, p->fn.csiz );
<>1589 -        }
  1606+        return 0;
  1607+}
15901608 # endif
 15911609 
 15921610 #ifndef PRTDCON
     
 !
16111629 
 16121630 
 16131631 int edebug = 0;
<> 1632+void
16141633 ecomp( p ) register NODE *p; {
 16151634 # ifndef BUG2
 16161635         if( edebug ) fwalk( p, eprint, 0 );
     
 !
16931712 
 16941713 # else
 16951714 
<>1696 -p2tree(p) register NODE *p; {
 1697 -        register ty;
  1715+void
  1716+p2tree(NODE *p)
  1717+{
  1718+        int ty;
<_16981719 
 16991720 # ifdef MYP2TREE
 17001721         MYP2TREE(p);  /* local action can be taken here; then return... */
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-03 04:16 +0200