diagnostics: fix use of complain_indent

* src/symtab.c (symbol_class_set): Here.
* tests/diagnostics.at, tests/input.at, tests/regression.at: Adjust
expectations.
This commit is contained in:
Akim Demaille
2019-09-13 21:04:49 +02:00
parent 19da501e06
commit 32dff87c1d
4 changed files with 12 additions and 11 deletions

View File

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

View File

@@ -73,31 +73,31 @@ exp: %empty;
[[input.y:9.12-14: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
9 | %token FOO <warning>FOO</warning> FOO
| <warning>^~~</warning>
input.y:9.8-10: previous declaration
input.y:9.8-10: previous declaration
9 | %token <note>FOO</note> FOO FOO
| <note>^~~</note>
input.y:9.16-18: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
9 | %token FOO FOO <warning>FOO</warning>
| <warning>^~~</warning>
input.y:9.8-10: previous declaration
input.y:9.8-10: previous declaration
9 | %token <note>FOO</note> FOO FOO
| <note>^~~</note>
input.y:10.8-10: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
10 | %token <warning>FOO</warning> FOO FOO
| <warning>^~~</warning>
input.y:9.8-10: previous declaration
input.y:9.8-10: previous declaration
9 | %token <note>FOO</note> FOO FOO
| <note>^~~</note>
input.y:10.13-15: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
10 | %token FOO <warning>FOO</warning> FOO
| <warning>^~~</warning>
input.y:9.8-10: previous declaration
input.y:9.8-10: previous declaration
9 | %token <note>FOO</note> FOO FOO
| <note>^~~</note>
input.y:10.18-20: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
10 | %token FOO FOO <warning>FOO</warning>
| <warning>^~~</warning>
input.y:9.8-10: previous declaration
input.y:9.8-10: previous declaration
9 | %token <note>FOO</note> FOO FOO
| <note>^~~</note>
]])
@@ -300,7 +300,7 @@ exp:^M
[[input.y:11.9-11: <warning>warning:</warning> symbol FOO redeclared [<warning>-Wother</warning>]
11 | %token
<warning>FOO</warning>
| <warning>^~~</warning>
| <warning>^~~</warning>
input.y:10.9-11: previous declaration
10 | %token
<note>FOO</note>

View File

@@ -633,19 +633,19 @@ AT_BISON_CHECK([-fcaret input.y], [0], [],
[[input.y:1.12-14: warning: symbol FOO redeclared [-Wother]
1 | %token FOO FOO
| ^~~
input.y:1.8-10: previous declaration
input.y:1.8-10: previous declaration
1 | %token FOO FOO
| ^~~
input.y:2.15-17: warning: symbol BAR redeclared [-Wother]
2 | %token BAR 12 BAR 12
| ^~~
input.y:2.8-10: previous declaration
input.y:2.8-10: previous declaration
2 | %token BAR 12 BAR 12
| ^~~
input.y:3.14-16: warning: symbol EOF redeclared [-Wother]
3 | %token EOF 0 EOF 0
| ^~~
input.y:3.8-10: previous declaration
input.y:3.8-10: previous declaration
3 | %token EOF 0 EOF 0
| ^~~
]])

View File

@@ -401,7 +401,7 @@ AT_BISON_CHECK([-fcaret -o input.c input.y], [[0]], [[]],
[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
22 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
| ^~~~~~~
input.y:21.8-14: previous declaration
input.y:21.8-14: previous declaration
21 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
| ^~~~~~~
input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used more than once as a literal string [-Wother]