scc

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

commit f426a4d4ddaad3eb752814fc040f0b180775ce16
parent ac748964eb6c3535320d3bedc211a4e272cf946f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 18 Aug 2015 14:36:03 +0200

Call install() in label()

The message of label() is outdated and current version
of install() handles this situation, so we can call it directly.

Diffstat:
Mcc1/stmt.c | 12+-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -20,18 +20,8 @@ label(void) switch (yytoken) { case IDEN: case TYPEIDEN: - /* - * We cannot call to insert() because the call to lookup in - * lex.c was done in NS_IDEN namespace, and it is impossibe - * to fix this point, because an identifier at the beginning - * of a statement may be part of an expression or part of a - * label. This double call to lookup() is going to generate - * an undefined symbol that is not going to be used ever. - */ - sym = lookup(NS_LABEL); - if (sym->flags & ISDECLARED) + if ((sym = install(NS_LABEL, yylval.sym)) == NULL) error("label '%s' already defined", yytoken); - sym->flags |= ISDECLARED; emit(OLABEL, sym); next(); expect(':');