mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
diagnostics: always point to the first directive
Some directives cannot be used several times (e.g., a given symbol may only have a single printer). In case of repeated definitions, an error is issued for the second definition, yet it is not discarded, and becomes the definition used for the rest of the file. This is not consistent with the idea that multiple definitions are not allowed: discard any repeated directive. * src/symtab.c (symbol_type_set, symbol_code_props_set) (semantic_type_code_props_set, symbol_class_set, symbol_translation): Discard repeated directives. * tests/input.at (Default %printer and %destructor redeclared) (Per-type %printer and %destructor redeclared): Update expectations.
This commit is contained in:
@@ -382,14 +382,14 @@ input.y:2.10-24: previous declaration
|
||||
input.y:11.13-29: error: %destructor redeclaration for <>
|
||||
%destructor { destroy ($$); } <>;
|
||||
^^^^^^^^^^^^^^^^^
|
||||
input.y:4.13-29: previous declaration
|
||||
%destructor { destroy ($$); } <>
|
||||
input.y:1.13-29: previous declaration
|
||||
%destructor { destroy ($$); } <> <>
|
||||
^^^^^^^^^^^^^^^^^
|
||||
input.y:12.10-24: error: %printer redeclaration for <>
|
||||
%printer { print ($$); } <>;
|
||||
^^^^^^^^^^^^^^^
|
||||
input.y:5.10-24: previous declaration
|
||||
%printer { print ($$); } <>
|
||||
input.y:2.10-24: previous declaration
|
||||
%printer { print ($$); } <> <>
|
||||
^^^^^^^^^^^^^^^
|
||||
]])
|
||||
])
|
||||
@@ -426,17 +426,17 @@ AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:4.13-29: error: %destructor redeclaration for <field1>
|
||||
input.y:1.13-29: previous declaration
|
||||
input.y:4.13-29: error: %destructor redeclaration for <field1>
|
||||
input.y:4.13-29: previous declaration
|
||||
input.y:1.13-29: previous declaration
|
||||
input.y:5.10-24: error: %printer redeclaration for <field2>
|
||||
input.y:2.10-24: previous declaration
|
||||
input.y:5.10-24: error: %printer redeclaration for <field2>
|
||||
input.y:5.10-24: previous declaration
|
||||
input.y:2.10-24: previous declaration
|
||||
input.y:11.13-29: error: %destructor redeclaration for <field2>
|
||||
input.y:1.13-29: previous declaration
|
||||
input.y:11.13-29: error: %destructor redeclaration for <field1>
|
||||
input.y:4.13-29: previous declaration
|
||||
input.y:1.13-29: previous declaration
|
||||
input.y:12.10-24: error: %printer redeclaration for <field2>
|
||||
input.y:5.10-24: previous declaration
|
||||
input.y:2.10-24: previous declaration
|
||||
input.y:12.10-24: error: %printer redeclaration for <field1>
|
||||
input.y:2.10-24: previous declaration
|
||||
]])
|
||||
|
||||
Reference in New Issue
Block a user