summaryrefslogtreecommitdiff
path: root/src/symtab.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-09-06 17:47:16 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-09-07 17:09:43 +0200
commit378963b1396272a1707e2f888dea7e2376a0e8ae (patch)
tree4531c42e8190812d79f0284275480668bab90afa /src/symtab.c
parent2dd882bce5a37996cbcaa9a646cde7221d30ad7d (diff)
downloadbison-378963b1396272a1707e2f888dea7e2376a0e8ae.tar.gz
tests: check token redeclaration
* src/symtab.c (symbol_class_set): Report previous definitions when redeclared. * tests/input.at (Symbol redeclared): New.
Diffstat (limited to 'src/symtab.c')
-rw-r--r--src/symtab.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/symtab.c b/src/symtab.c
index 60733e72..684fdf3d 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -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;
}