tests: check token redeclaration

* src/symtab.c (symbol_class_set): Report previous definitions when
redeclared.
* tests/input.at (Symbol redeclared): New.
This commit is contained in:
Akim Demaille
2019-09-06 17:47:16 +02:00
parent d3a86f7b20
commit 375eb71489
4 changed files with 58 additions and 6 deletions

View File

@@ -462,7 +462,13 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
if (declaring)
{
if (s->status == declared)
complain (&loc, Wother, _("symbol %s redeclared"), sym->tag);
{
unsigned i = 0;
complain (&loc, Wother, _("symbol %s redeclared"), sym->tag);
i += SUB_INDENT;
complain_indent (&sym->location, Wother, &i,
_("previous declaration"));
}
else
s->status = declared;
}