mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
warnings: remove spurious suffixes on context
Rectify a bug that introduced suffixes out of place. * src/complainc.c (complains): Handle all three special warning bits. * src/scan-code.l (show_sub_message): Remove useless argument. * tests/named-refs.at: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
fa98bb3233
commit
a49f4904c3
@@ -130,7 +130,7 @@ complains (const location *loc, warnings flags, const char *message,
|
|||||||
error_message (loc, fatal, _("fatal error"), message, args);
|
error_message (loc, fatal, _("fatal error"), message, args);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
else if (flags & (complaint | warnings_flag))
|
else if (flags & (complaint | warnings_flag | silent))
|
||||||
{
|
{
|
||||||
const char* prefix =
|
const char* prefix =
|
||||||
flags & (errors_flag | complaint) ? _("error") : _("warning");
|
flags & (errors_flag | complaint) ? _("error") : _("warning");
|
||||||
|
|||||||
@@ -402,13 +402,12 @@ get_at_spec(unsigned symbol_index)
|
|||||||
static void
|
static void
|
||||||
show_sub_message (const char* cp, bool explicit_bracketing,
|
show_sub_message (const char* cp, bool explicit_bracketing,
|
||||||
int midrule_rhs_index, char dollar_or_at,
|
int midrule_rhs_index, char dollar_or_at,
|
||||||
warnings wflags, unsigned indent,
|
unsigned indent, const variant *var)
|
||||||
const variant *var)
|
|
||||||
{
|
{
|
||||||
const char *at_spec = get_at_spec (var->symbol_index);
|
const char *at_spec = get_at_spec (var->symbol_index);
|
||||||
|
|
||||||
if (var->err == 0)
|
if (var->err == 0)
|
||||||
complain_at_indent (var->loc, wflags, &indent,
|
complain_at_indent (var->loc, silent, &indent,
|
||||||
_("refers to: %c%s at %s"), dollar_or_at,
|
_("refers to: %c%s at %s"), dollar_or_at,
|
||||||
var->id, at_spec);
|
var->id, at_spec);
|
||||||
else
|
else
|
||||||
@@ -445,7 +444,7 @@ show_sub_message (const char* cp, bool explicit_bracketing,
|
|||||||
_(", cannot be accessed from mid-rule action at $%d"),
|
_(", cannot be accessed from mid-rule action at $%d"),
|
||||||
midrule_rhs_index);
|
midrule_rhs_index);
|
||||||
|
|
||||||
complain_at_indent (id_loc, wflags, &indent, "%s",
|
complain_at_indent (id_loc, silent, &indent, "%s",
|
||||||
obstack_finish0 (&msg_buf));
|
obstack_finish0 (&msg_buf));
|
||||||
obstack_free (&msg_buf, 0);
|
obstack_free (&msg_buf, 0);
|
||||||
}
|
}
|
||||||
@@ -454,14 +453,14 @@ show_sub_message (const char* cp, bool explicit_bracketing,
|
|||||||
static void
|
static void
|
||||||
show_sub_messages (const char* cp, bool explicit_bracketing,
|
show_sub_messages (const char* cp, bool explicit_bracketing,
|
||||||
int midrule_rhs_index, char dollar_or_at,
|
int midrule_rhs_index, char dollar_or_at,
|
||||||
warnings wflags, unsigned indent)
|
unsigned indent)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < variant_count; ++i)
|
for (i = 0; i < variant_count; ++i)
|
||||||
show_sub_message (cp, explicit_bracketing,
|
show_sub_message (cp, explicit_bracketing,
|
||||||
midrule_rhs_index, dollar_or_at,
|
midrule_rhs_index, dollar_or_at,
|
||||||
wflags, indent, &variant_table[i]);
|
indent, &variant_table[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returned from "parse_ref" when the reference
|
/* Returned from "parse_ref" when the reference
|
||||||
@@ -614,7 +613,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
|
|
||||||
if (variant_count > 0)
|
if (variant_count > 0)
|
||||||
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
||||||
dollar_or_at, complaint, indent);
|
dollar_or_at, indent);
|
||||||
return INVALID_REF;
|
return INVALID_REF;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
@@ -625,7 +624,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
complain_at_indent (text_loc, Wother, &indent,
|
complain_at_indent (text_loc, Wother, &indent,
|
||||||
_("misleading reference: %s"), quote (text));
|
_("misleading reference: %s"), quote (text));
|
||||||
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
||||||
dollar_or_at, Wother, indent + SUB_INDENT);
|
dollar_or_at, indent + SUB_INDENT);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
unsigned symbol_index =
|
unsigned symbol_index =
|
||||||
@@ -640,7 +639,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
complain_at_indent (text_loc, complaint, &indent,
|
complain_at_indent (text_loc, complaint, &indent,
|
||||||
_("ambiguous reference: %s"), quote (text));
|
_("ambiguous reference: %s"), quote (text));
|
||||||
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
show_sub_messages (cp, explicit_bracketing, midrule_rhs_index,
|
||||||
dollar_or_at, complaint, indent + SUB_INDENT);
|
dollar_or_at, indent + SUB_INDENT);
|
||||||
return INVALID_REF;
|
return INVALID_REF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,9 +254,9 @@ AT_BISON_CHECK([-o test.c test.y], 1, [],
|
|||||||
[[test.y:50.51-60: error: invalid reference: '$<ival>lo9'
|
[[test.y:50.51-60: error: invalid reference: '$<ival>lo9'
|
||||||
test.y:50.3-68: symbol not found in production: lo9
|
test.y:50.3-68: symbol not found in production: lo9
|
||||||
test.y:51.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
test.y:51.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
||||||
test.y:42.1-3: refers to: $exp at $$ [-Wother]
|
test.y:42.1-3: refers to: $exp at $$
|
||||||
test.y:51.7: possibly meant: $x, hiding $exp at $1 [-Wother]
|
test.y:51.7: possibly meant: $x, hiding $exp at $1
|
||||||
test.y:51.41: possibly meant: $r, hiding $exp at $4 [-Wother]
|
test.y:51.41: possibly meant: $r, hiding $exp at $4
|
||||||
test.y:52.51-52: error: $l of 'exp' has no declared type
|
test.y:52.51-52: error: $l of 'exp' has no declared type
|
||||||
test.y:55.46-49: error: invalid reference: '$r12'
|
test.y:55.46-49: error: invalid reference: '$r12'
|
||||||
test.y:55.3-53: symbol not found in production: r12
|
test.y:55.3-53: symbol not found in production: r12
|
||||||
@@ -278,8 +278,8 @@ foo.bar: '2'
|
|||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([-o test.c test.y], 0, [],
|
AT_BISON_CHECK([-o test.c test.y], 0, [],
|
||||||
[[test.y:11.22-29: warning: misleading reference: '$foo.bar' [-Wother]
|
[[test.y:11.22-29: warning: misleading reference: '$foo.bar' [-Wother]
|
||||||
test.y:11.8-10: refers to: $foo at $1 [-Wother]
|
test.y:11.8-10: refers to: $foo at $1
|
||||||
test.y:11.12-18: possibly meant: $[foo.bar] at $2 [-Wother]
|
test.y:11.12-18: possibly meant: $[foo.bar] at $2
|
||||||
]])
|
]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user