scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 20cea36cf1e5f8278cd79cd3e9b7905bfbac483e
parent 489d4004127ad5b60f46ddd1c076534c6c583230
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 26 Sep 2015 19:47:51 +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().

Diffstat:
Mcc1/cpp.c | 5++++-
Mcc1/tests/test026.c | 20++++++++++----------
2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -247,6 +247,7 @@ static int getpars(Symbol *args[NR_MACROARG]) { int n = -1; + Symbol *sym; if (!accept('(')) return n; @@ -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 @@ -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 } */