[hackers] [scc] Install parameter macros in the symbol table || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 26 Sep 2015 19:52:34 +0200 (CEST)

commit 20cea36cf1e5f8278cd79cd3e9b7905bfbac483e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Sep 26 19:47:51 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Sep 26 19:51:42 2015 +0200

    Install parameter macros in the symbol table
    
    Due to the new implementation of the symbol table
    it is always needed a call to install().

diff --git a/cc1/cpp.c b/cc1/cpp.c
index ce24967..5bc0515 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -247,6 +247,7 @@ static int
 getpars(Symbol *args[NR_MACROARG])
 {
         int n = -1;
+ Symbol *sym;
 
         if (!accept('('))
                 return n;
_AT_@ -263,7 +264,9 @@ getpars(Symbol *args[NR_MACROARG])
                         cpperror("macro arguments must be identifiers");
                         return NR_MACROARG;
                 }
- args[n++] = yylval.sym;
+ sym = install(NS_IDEN, yylval.sym);
+ sym->flags |= ISUSED;
+ args[n++] = sym;
                 next();
         } while (accept(','));
         expect(')');
diff --git a/cc1/tests/test026.c b/cc1/tests/test026.c
index 6003650..24c7398 100644
--- a/cc1/tests/test026.c
+++ b/cc1/tests/test026.c
_AT_@ -3,18 +3,18 @@
 name: TEST026
 descritpion: Test of predefined cpp macros
 output:
-F1
-G2 F1 main
+F2
+G3 F2 main
 {
 \
-A3 I y
-A5 P p
- A5 "746573743032362E63 'P :P
- A3 #I1E :I
- A3 #I1 :I
- A3 #I1 :I
- A3 #I1 :I
- A3 A3 :I
+A4 I y
+A6 P p
+ A6 "746573743032362E63 'P :P
+ A4 #I1E :I
+ A4 #I1 :I
+ A4 #I1 :I
+ A4 #I1 :I
+ A4 #I1 :I
 }
 */
 
Received on Sat Sep 26 2015 - 19:52:34 CEST

This archive was generated by hypermail 2.3.0 : Sat Sep 26 2015 - 20:00:11 CEST