mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
diagnostics: modernize the display of submessages
Since Bison 2.7, output was indented four spaces for explanatory
statements. For example:
input.y:2.7-13: error: %type redeclaration for exp
input.y:1.7-11: previous declaration
Since the introduction of caret-diagnostics, it became less clear.
Remove the indentation and display submessages as in GCC:
input.y:2.7-13: error: %type redeclaration for exp
2 | %type <float> exp
| ^~~~~~~
input.y:1.7-11: note: previous declaration
1 | %type <int> exp
| ^~~~~
* src/complain.h (SUB_INDENT): Remove.
(warnings): Add "note" to the enum.
* src/complain.h, src/complain.c (complain_indent): Replace by...
(subcomplain): this.
Adjust all dependencies.
* tests/actions.at, tests/diagnostics.at, tests/glr-regression.at,
* tests/input.at, tests/named-refs.at, tests/regression.at:
Adjust expectations.
This commit is contained in:
committed by
Akim Demaille
parent
a09d0ae4d1
commit
e09a72eeb0
17
src/reader.c
17
src/reader.c
@@ -124,16 +124,13 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
aver (merge_function != NULL && merger_find == merger);
|
||||
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
||||
{
|
||||
int indent = 0;
|
||||
complain_indent (&declaration_loc, complaint, &indent,
|
||||
_("result type clash on merge function %s: "
|
||||
"<%s> != <%s>"),
|
||||
quote (merge_function->name), type,
|
||||
merge_function->type);
|
||||
indent += SUB_INDENT;
|
||||
complain_indent (&merge_function->type_declaration_loc, complaint,
|
||||
&indent,
|
||||
_("previous declaration"));
|
||||
complain (&declaration_loc, complaint,
|
||||
_("result type clash on merge function %s: "
|
||||
"<%s> != <%s>"),
|
||||
quote (merge_function->name), type,
|
||||
merge_function->type);
|
||||
subcomplain (&merge_function->type_declaration_loc, complaint,
|
||||
_("previous declaration"));
|
||||
}
|
||||
merge_function->type = uniqstr_new (type);
|
||||
merge_function->type_declaration_loc = declaration_loc;
|
||||
|
||||
Reference in New Issue
Block a user