shithub: scc

Download patch

ref: 9cba57490676e913c7afd25c62cd9e8acc7ad126
parent: 69ab3ec844f86006ab12f04df4fd75ca2ae55c5e
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Dec 19 07:27:24 EST 2016

[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.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -127,6 +127,8 @@
 {
 	unsigned short id;
 
+	if (lexmode == CPPMODE)
+		return 0;
 	id = ++counterid;
 	if (id == 0) {
 		die("Overflow in %s identifiers",
@@ -219,11 +221,9 @@
 {
 	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)