mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16: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
@@ -525,15 +525,13 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
||||
= atoi (muscle_find_const (how_name));
|
||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||
goto end;
|
||||
int i = 0;
|
||||
/* If assigning the same value, make it a warning. */
|
||||
warnings warn = STREQ (value, current_value) ? Wother : complaint;
|
||||
complain_indent (&variable_loc, warn, &i,
|
||||
_("%%define variable %s redefined"),
|
||||
quote (variable));
|
||||
i += SUB_INDENT;
|
||||
complain (&variable_loc, warn,
|
||||
_("%%define variable %s redefined"),
|
||||
quote (variable));
|
||||
location loc = muscle_percent_define_get_loc (variable);
|
||||
complain_indent (&loc, warn, &i, _("previous definition"));
|
||||
subcomplain (&loc, warn, _("previous definition"));
|
||||
fixits_register (&variable_loc, "");
|
||||
warned = true;
|
||||
}
|
||||
@@ -739,14 +737,12 @@ muscle_percent_define_check_values (char const * const *values)
|
||||
if (!*values)
|
||||
{
|
||||
location loc = muscle_percent_define_get_loc (*variablep);
|
||||
int i = 0;
|
||||
complain_indent (&loc, complaint, &i,
|
||||
_("invalid value for %%define variable %s: %s"),
|
||||
quote (*variablep), quote_n (1, value));
|
||||
i += SUB_INDENT;
|
||||
complain (&loc, complaint,
|
||||
_("invalid value for %%define variable %s: %s"),
|
||||
quote (*variablep), quote_n (1, value));
|
||||
for (values = variablep + 1; *values; ++values)
|
||||
complain_indent (&loc, complaint | no_caret | silent, &i,
|
||||
_("accepted value: %s"), quote (*values));
|
||||
subcomplain (&loc, complaint | no_caret | silent,
|
||||
_("accepted value: %s"), quote (*values));
|
||||
}
|
||||
else
|
||||
while (*values)
|
||||
|
||||
Reference in New Issue
Block a user