shithub: scc

Download patch

ref: 9493bae2f3591649473115922fcc1a6f9b552b1d
parent: 45d979a0af4019cce0298bd6cb26a54273ef4169
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 6 11:45:05 EST 2017

[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.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -899,6 +899,7 @@
 	sym->flags &= ~SEMITTED;
 	emit(OFUN, sym);
 	compound(NULL, NULL, NULL);
+	popctx();
 	emit(OEFUN, NULL);
 	flushtypes();
 	curfun = ocurfun;
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -362,12 +362,6 @@
 	--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('}');
 }