[hackers] [scc] [cc2] Initialize the type of symbol nodes || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 22 Apr 2016 15:02:00 +0200 (CEST)

commit 09da26144179fcba493815c2068f7df631cc9b54
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Apr 22 14:58:09 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Apr 22 14:58:09 2016 +0200

    [cc2] Initialize the type of symbol nodes
    
    A node contains a symbol has the same type that the symbol
    contained. The code lacked this initialization, and this
    was the reason it was creating nodes without type.

diff --git a/cc2/parser.c b/cc2/parser.c
index d03f036..a288da4 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -181,10 +181,13 @@ static void
 symbol(char *token, union tokenop u)
 {
         Node *np;
+ Symbol *sym;
 
         sclass = u.op >> 8;
         np = newnode();
- np->u.sym = getsym(atoi(token+1));
+ sym = getsym(atoi(token+1));
+ np->u.sym = sym;
+ np->type = sym->type;
         np->op = u.op & 0xFF;
         push(np);
 }
Received on Fri Apr 22 2016 - 15:02:00 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 22 2016 - 15:12:15 CEST