scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit a84618bba7d82a3c2cd9f96bcf12344199174761
parent eb30e9795a8b09179fac633a02d866428b7adb78
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  6 Feb 2017 16:45:05 +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.

Diffstat:
Mcc1/decl.c | 1+
Mcc1/stmt.c | 6------
2 files changed, 1 insertion(+), 6 deletions(-)

diff --git 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 @@ -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('}'); }