commit ff3de6ad52b27002a8ff2c3611f02b6b45978b00
parent 29af9b741e8e4f568d86477d1350e5131be79f46
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 13 Apr 2026 10:49:17 +0200
cc1: Fix check of duplicated macro parameter
When the code changed to use the tokenizer we didn't realize that
the check for duplicated parameter was using yytext, but in one
of the cases we were calling next() that invalidated the use of
yytext. Also, the new namespace added for macro parameters had to
be used instead of the generic NS_IDEN used before. Thankfully
one of the error tests catched this error.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cmd/scc-cc/cc1/cpp.c b/src/cmd/scc-cc/cc1/cpp.c
@@ -542,8 +542,8 @@ getpars(Symbol *args[NR_MACROARG])
return NR_MACROARG;
}
- if ((sym = install(NS_IDEN, sym)) == NULL) {
- errorp("duplicated macro parameter '%s'", yytext);
+ if (!install(NS_MACROPAR, sym)) {
+ errorp("duplicated macro parameter '%s'", sym->name);
} else {
sym->flags |= SUSED;
args[n++] = sym;