[hackers] [scc] [cc2] Fix initialization of parser variables || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 11 Apr 2016 17:17:36 +0200 (CEST)

commit b054b416db6ea7150a34823cb898e45c42d5574c
Author: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
AuthorDate: Mon Apr 11 16:52:23 2016 +0200
Commit: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
CommitDate: Mon Apr 11 16:52:23 2016 +0200

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

diff --git a/cc2/parser.c b/cc2/parser.c
index a02de01..39a777f 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -613,18 +613,13 @@ stmt(void)
 static void
 beginfun(void)
 {
- inpars = 0;
+ inpars = 1;
         pushctx();
 }
 
 static void
 endfun(void)
 {
- Node *np;
-
- np = newnode();
- curfun = NULL;
- inpars = 0; /* I know, it is a bit redundant */
         endf = 1;
 }
 
_AT_@ -634,7 +629,6 @@ parse(void)
         cleannodes(); /* remove code of previous function */
         popctx(); /* remove context of previous function */
         curfun = NULL;
- endf = 0;
 
         while (!endf && nextline())
                 /* nothing */;
Received on Mon Apr 11 2016 - 17:17:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 11 2016 - 17:24:18 CEST