commit a84618bba7d82a3c2cd9f96bcf12344199174761
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Mon Feb 6 16:45:05 2017 +0100
Commit:     Roberto E. Vargas Caballero <k...@shike2.com>
CommitDate: Mon Feb 6 16:45:05 2017 +0100

    [cc1] Remove popctx() from compound()
    
    After the commit fea243a this popctx() it is not longer
    needed to happen in compound(), where it was a bit difficult
    to explain why it was needed, and it was very, very tricky.
    A better place where to pop the parameter context is in
    decl(), where it already pop the parameter context in the
    case of prototypes.

diff --git a/cc1/decl.c b/cc1/decl.c
index 004300f..4f7d273 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -899,6 +899,7 @@ decl(void)
        sym->flags &= ~SEMITTED;
        emit(OFUN, sym);
        compound(NULL, NULL, NULL);
+       popctx();
        emit(OEFUN, NULL);
        flushtypes();
        curfun = ocurfun;
diff --git a/cc1/stmt.c b/cc1/stmt.c
index dc778d0..b833c39 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -362,12 +362,6 @@ compound(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
        --nested;
 
        popctx();
-       /*
-        * curctx == GLOBALCTX+1 means we are at the end of a function
-        * so we have to pop the context related to the parameters
-        */
-       if (curctx == GLOBALCTX+1)
-               popctx();
        expect('}');
 }
 

Reply via email to