scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 668cf8197fe0249df975adfae16d2df56f2cc696
parent c73e0b8d57ea9f47ac5de40e54eb32aacdca28f6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 19 Dec 2016 12:27:24 +0100

[cc1] Do not create id for cpp symbols

CPP symbols are not going to be emitted ever, so it is
stupid to create identifiers for them.

Diffstat:
Mcc1/symbol.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -127,6 +127,8 @@ newid(void) { unsigned short id; + if (lexmode == CPPMODE) + return 0; id = ++counterid; if (id == 0) { die("Overflow in %s identifiers", @@ -219,11 +221,9 @@ newstring(char *s, size_t len) { Symbol *sym = newsym(NS_IDEN); - if (lexmode != CPPMODE) { + if (lexmode != CPPMODE) sym->type = mktype(chartype, ARY, len, NULL); - sym->id = newid(); - } - + sym->id = newid(); sym->flags |= SSTRING | SCONSTANT | SPRIVATE; sym->u.s = xmalloc(len); if (s)