ref: cc767027f7fc598346f4ec9991f55085fd44230e
parent: b419af2e240fc9da3ea5fa5b4ecad1c9fc71cbb1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Apr 11 12:52:23 EDT 2016
[cc2] Fix initialization of parser variables Curfun cannot be cleaned in endfun(), because then we lost the begin of the function for all the code generators. Inpars() was not correctly set, so any function could be loaded.
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -613,7 +613,7 @@
static void
beginfun(void)
{
- inpars = 0;
+ inpars = 1;
pushctx();
}
@@ -620,11 +620,6 @@
static void
endfun(void)
{
- Node *np;
-
- np = newnode();
- curfun = NULL;
- inpars = 0; /* I know, it is a bit redundant */
endf = 1;
}
@@ -634,7 +629,6 @@
cleannodes(); /* remove code of previous function */
popctx(); /* remove context of previous function */
curfun = NULL;
- endf = 0;
while (!endf && nextline())
/* nothing */;