mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
java: use full locations for diagnostics about destructors
Currently we use the syncline to report errors about a symbol's destructor/printer. This is not accurate (only file and line), and this is incorrect: the file name is double quotes (a recent change, needed to make sure we escape properly double quotes in it). And worst of all: with --no-line, b4_syncline expands to nothing. Rather, push the locations into the backend, and use them. * src/muscle-tab.h, src/muscle-tab.c (muscle_location_grow): Make it public. * src/output.c (prepare_symbol_definitions): Use it to pubish the location of the printer and destructor. * data/skeletons/lalr1.java: Use complain_at instead of complain. * tests/java.at (Java invalid directives): Adjust expectations. * data/skeletons/bison.m4 (b4_symbol_action_location): Remove. We should not use b4_syncline this way.
This commit is contained in:
@@ -438,13 +438,6 @@ m4_define([b4_symbol_tag_comment],
|
||||
])
|
||||
|
||||
|
||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
||||
# -------------------------------------------
|
||||
# Report the location of the KIND action as FILE:LINE.
|
||||
m4_define([b4_symbol_action_location],
|
||||
[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
|
||||
|
||||
|
||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||
# ----------------------------------
|
||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
m4_include(b4_skeletonsdir/[java.m4])
|
||||
|
||||
b4_defines_if([b4_complain([%s: %%defines does not make sense in Java],
|
||||
[b4_skeleton])])
|
||||
b4_defines_if([b4_complain([%defines does not make sense in Java])])
|
||||
|
||||
# We do not depend on %debug in Java, but pacify warnings about
|
||||
# non-used flags.
|
||||
@@ -26,9 +25,8 @@ b4_parse_trace_if([0], [0])
|
||||
|
||||
m4_define([b4_symbol_no_destructor_assert],
|
||||
[b4_symbol_if([$1], [has_destructor],
|
||||
[b4_complain([%s: %s: %%destructor does not make sense in Java],
|
||||
[b4_skeleton],
|
||||
[b4_symbol_action_location([$1], [destructor])])])])
|
||||
[b4_complain_at(m4_unquote(b4_symbol([$1], [destructor_loc])),
|
||||
[%destructor does not make sense in Java])])])
|
||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||
|
||||
# Setup some macros for api.push-pull.
|
||||
|
||||
Reference in New Issue
Block a user