Put explicit starttree() and endtree() around all calls to rcexpr0() in c0 part
authorNick Downing <downing.nick@gmail.com>
Thu, 9 Feb 2017 14:07:55 +0000 (01:07 +1100)
committerNick Downing <downing.nick@gmail.com>
Thu, 9 Feb 2017 14:07:55 +0000 (01:07 +1100)
c0.h
c00.c
c01.c
c02.c
c04.c

diff --git a/c0.h b/c0.h
index 5e3114e..b48839b 100644 (file)
--- a/c0.h
+++ b/c0.h
@@ -304,7 +304,7 @@ void putstr __P((int lab, register int max));
 void cntstr __P((void));
 int getcc __P((void));
 int mapch __P((int ac));
-union tree0 *tree0 __P((int eflag));
+union tree0 *tree0 __P((/*int eflag*/));
 union tree0 *xprtype0 __P((void));
 char *copnum __P((int len));
 
@@ -341,7 +341,7 @@ void strinit __P((struct nmlist *np, int sclass));
 void setinit __P((register struct nmlist *np));
 void statement __P((void));
 int forstmt __P((void));
-union tree0 *pexpr __P((int eflag));
+union tree0 *pexpr __P((/*int eflag*/));
 void pswitch0 __P((void));
 void funchead __P((void));
 void blockhead __P((void));
diff --git a/c00.c b/c00.c
index 6968a25..75a2010 100644 (file)
--- a/c00.c
+++ b/c00.c
@@ -602,15 +602,15 @@ loop:
  * "," or ":" because those delimiters are special
  * in initializer (and some other) expressions.
  */
-union tree0 *tree0(eflag) int eflag; {
+union tree0 *tree0(/*eflag*/) /*int eflag;*/ {
        int *op, opst[SSIZE], *pp, prst[SSIZE];
        register int andflg, o;
        register struct nmlist *cs;
        int p, ps, os, xo = 0, *xop;
-       char *svtree;
+       /*char *svtree;*/
        static struct cnode garbage = { CON, INT, (int *)NULL, (union str *)NULL, 0 };
 
-       svtree = starttree();
+       /*svtree = starttree();*/
        op = opst;
        pp = prst;
        *op = SEOF;
@@ -832,8 +832,8 @@ opon1:
        case SEOF:
                peeksym = o;
                build(0);               /* flush conversions */
-               if (eflag)
-                       endtree(svtree);
+               /*if (eflag)
+                       endtree(svtree);*/
                return(*--cp0);
 
        case COMMA:
@@ -877,8 +877,8 @@ opon1:
 syntax:
        error0("Expression syntax");
        errflush(o);
-       if (eflag)
-               endtree(svtree);
+       /*if (eflag)
+               endtree(svtree);*/
        return((union tree0 *) &garbage);
 }
 
diff --git a/c01.c b/c01.c
index d5dee76..ac3278d 100644 (file)
--- a/c01.c
+++ b/c01.c
@@ -892,13 +892,14 @@ int fold(op, p1, p2) int op; register union tree0 *p1; union tree0 *p2; {
  */
 int conexp() {
        register union tree0 *t;
-
+ char *st = starttree();
        initflg++;
-       if (t = tree0(1))
+       if (t = tree0(/*1*/))
                if (t->t.op != CON)
                        error0("Constant required");
        initflg--;
  /*fprintf(stderr, "conexp() %d\n", t->c.value);*/
+ endtree(st);
        return(t->c.value);
 }
 
diff --git a/c02.c b/c02.c
index 6104c06..e9f3fa7 100644 (file)
--- a/c02.c
+++ b/c02.c
@@ -186,7 +186,7 @@ int cinit(anp, flex, sclass) struct nmlist *anp; int flex; int sclass; {
                        char *st;
                        initflg++;
                        st = starttree();
-                       s = tree0(0);
+                       s = tree0(/*0*/);
                        initflg = 0;
                        if (np.hflag&FFIELD)
                                error0("No field initialization");
@@ -353,7 +353,8 @@ stmt:
                        register int o2;
                        register union tree0 *np;
 
-                       np = pexpr(1);
+ char *st = starttree();
+                       np = pexpr(/*1*/);
                        o2 = 0;
                        if ((o1=symbol())==KEYW) switch (cval) {
                        case GOTO:
@@ -385,6 +386,7 @@ stmt:
                                chconbrk(o2);
                                cbranch0(np, o2, 1);
                        hardif:
+ endtree(st);
                                if ((o=symbol())!=SEMI)
                                        goto syntax;
                                if ((o1=symbol())==KEYW && cval==ELSE) 
@@ -394,6 +396,7 @@ stmt:
                        }
                        peeksym = o1;
                        cbranch0(np, o1=isn0++, 0);
+ endtree(st);
                        statement();
                        if ((o=symbol())==KEYW && cval==ELSE) {
                                o2 = isn0++;
@@ -409,11 +412,14 @@ stmt:
                }
 
                case WHILE: {
+ char *st;
                        register int o2;
                        o1 = contlab;
                        o2 = brklab;
                        label0(contlab = isn0++);
-                       cbranch0(pexpr(1), brklab=isn0++, 0);
+ st = starttree();
+                       cbranch0(pexpr(/*1*/), brklab=isn0++, 0);
+ endtree(st);
                        statement();
                        branch0(contlab);
                        label0(brklab);
@@ -443,7 +449,9 @@ stmt:
                        label0(contlab);
                        contlab = o1;
                        if ((o=symbol())==KEYW && cval==WHILE) {
-                               cbranch0(tree0(1), o3, 1);
+ char *st = starttree();
+                               cbranch0(tree0(/*1*/), o3, 1);
+ endtree(st);
                                label0(brklab);
                                brklab = o2;
                                goto semi;
@@ -475,7 +483,7 @@ stmt:
                        o1 = brklab;
                        brklab = isn0++;
                        st = starttree();
-                       np = pexpr(0);
+                       np = pexpr(/*0*/);
                        chkw(np, -1);
                        rcexpr0(block(RFORCE,0,(int *)NULL,(union str *)NULL,np,TNULL0));
                        endtree(st);
@@ -541,7 +549,11 @@ stmt:
        }
        }
        peeksym = o;
-       rcexpr0(tree0(1));
+ {
+  char *st = starttree();
+       rcexpr0(tree0(/*1*/));
+  endtree(st);
+ }
 
 semi:
        if ((o=symbol())==SEMI)
@@ -562,11 +574,15 @@ int forstmt() {
 
        if ((o=symbol()) != LPARN)
                return(o);
+ ss = starttree();
        if ((o=symbol()) != SEMI) {             /* init part */
                peeksym = o;
-               rcexpr0(tree0(1));
+               rcexpr0(tree0(/*1*/));
                if ((o=symbol()) != SEMI)
+ {
+  endtree(ss);
                        return(o);
+ }
        }
        l = isn0;
        isn0 += 3;
@@ -577,7 +593,7 @@ int forstmt() {
        st = NULL;
        if ((o=symbol()) != SEMI) {             /* test part */
                peeksym = o;
-               ss = starttree();
+ /*            ss = starttree();*/
                st = tree0(0);
                if ((o=symbol()) != SEMI) {
                        endtree(ss);
@@ -586,9 +602,9 @@ int forstmt() {
        }
        if ((o=symbol()) != RPARN) {    /* incr part */
                peeksym = o;
-               rcexpr0(tree0(1));
+               rcexpr0(tree0(/*1*/));
                if ((o=symbol()) != RPARN) {
-                       if (st)
+ /*                    if (st)*/
                                endtree(ss);
                        return(o);
                }
@@ -596,9 +612,10 @@ int forstmt() {
        label0(l+0);
        if (st) {
                cbranch0(st, l+1, 1);
-               endtree(ss);
+ /*            endtree(ss);*/
        } else
                branch0(l+1);
+ endtree(ss);
        branch0(brklab);
        label0(l+2);
        statement();
@@ -611,13 +628,13 @@ int forstmt() {
  * A parenthesized expression,
  * as after "if".
  */
-union tree0 *pexpr(eflag) int eflag; {
+union tree0 *pexpr(/*eflag*/) /*int eflag;*/ {
        register int o;
        register union tree0 *t;
 
        if ((o=symbol())!=LPARN)
                goto syntax;
-       t = tree0(eflag);
+       t = tree0(/*eflag*/);
        if ((o=symbol())!=RPARN)
                goto syntax;
        if (t->t.type==VOID)
diff --git a/c04.c b/c04.c
index 4d065c6..4f1e68b 100644 (file)
--- a/c04.c
+++ b/c04.c
@@ -303,7 +303,7 @@ void dogoto() {
        register char *st;
 
        st = starttree();
-       *cp0++ = tree0(0);
+       *cp0++ = tree0(/*0*/);
        build(STAR);
        chkw(np = *--cp0, -1);
        rcexpr0(block(JUMP, 0, (int *)NULL, (union str *)NULL, np, TNULL0));
@@ -320,7 +320,7 @@ void doret() {
 
                st = starttree();
                *cp0++ = (union tree0 *)&funcblk0;
-               *cp0++ = tree0(0);
+               *cp0++ = tree0(/*0*/);
                build(ASSIGN);
                cp0[-1] = cp0[-1]->t.tr2;
                build(RFORCE);