mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
In warnings, say "previous declaration" rather than "first
declaration". * src/symtab.c (redeclaration): Do that here. * src/reader.c (record_merge_function_type): In the case of a result type clash, report the previous declaration rather than the very first one in the grammar file. * tests/glr-regression.at (Missed %merge type warnings when LHS type is declared later): Add a third declaration to check this behavior. * tests/input.at (Incompatible Aliases): Update output.
This commit is contained in:
11
src/reader.c
11
src/reader.c
@@ -146,19 +146,16 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
merge_function = merge_function->next)
|
||||
merger_find += 1;
|
||||
assert (merge_function != NULL && merger_find == merger);
|
||||
if (merge_function->type == NULL)
|
||||
{
|
||||
merge_function->type = uniqstr_new (type);
|
||||
merge_function->type_declaration_location = declaration_loc;
|
||||
}
|
||||
else if (!UNIQSTR_EQ (merge_function->type, type))
|
||||
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
||||
{
|
||||
warn_at (declaration_loc,
|
||||
_("result type clash on merge function `%s': <%s> != <%s>"),
|
||||
merge_function->name, type, merge_function->type);
|
||||
warn_at (merge_function->type_declaration_location,
|
||||
_("first declaration"));
|
||||
_("previous declaration"));
|
||||
}
|
||||
merge_function->type = uniqstr_new (type);
|
||||
merge_function->type_declaration_location = declaration_loc;
|
||||
}
|
||||
|
||||
/*--------------------------------------.
|
||||
|
||||
Reference in New Issue
Block a user