[hackers] [scc] [cc1] Use ns from dangling symbol in popctx() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 22 Jan 2017 09:52:29 +0100 (CET)

commit 4fe052f8b8b9962366a33088871b73fa141b693a
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 22 09:45:46 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 22 09:45:46 2017 +0100

    [cc1] Use ns from dangling symbol in popctx()
    
    We don't know where popctx() is going to be called and we cannot
    be sure that the namespace wasn't changed.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 466c8c9..9780c07 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -105,7 +105,7 @@ void
 popctx(void)
 {
         Symbol *next, *sym;
- int dangling = 0;
+ int ns, dangling = 0;
 
         /*
          * we have to be careful before popping the current
_AT_@ -120,6 +120,7 @@ popctx(void)
          */
         if ((yytoken == IDEN || yytoken == TYPEIDEN) &&
             yylval.sym->ctx == curctx) {
+ ns = yylval.sym->ns;
                 dangling = 1;
         }
 
_AT_@ -148,7 +149,7 @@ popctx(void)
         }
 
         if (dangling) {
- yylval.sym = lookup(namespace, yytext, ALLOC);
+ yylval.sym = lookup(ns, yytext, ALLOC);
                 yytoken = yylval.sym->token;
         }
 }
Received on Sun Jan 22 2017 - 09:52:29 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 22 2017 - 10:00:23 CET