mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Also warn about non-used mid-rule values.
* src/symlist.h, src/symlist.c (symbol_list): Add a mid_rule member. (symbol_list_new): Adjust. * src/reader.c (symbol_typed_p): New. (grammar_rule_check): Use it. (grammar_midrule_action): Bind a mid-rule LHS to its rule. Check its rule. * tests/input.at (AT_CHECK_UNUSED_VALUES): New. Use it. * tests/actions.at (Exotic Dollars): Adjust.
This commit is contained in:
@@ -113,6 +113,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
exp: a_1 a_2 { $<val>$ = 3; } { $<val>$ = $<val>3 + 1; } a_5
|
||||
sum_of_the_five_previous_values
|
||||
{
|
||||
USE (($1, $2, $<foo>3, $<foo>4, $5));
|
||||
printf ("%d\n", $6);
|
||||
}
|
||||
;
|
||||
@@ -146,11 +147,7 @@ main (void)
|
||||
}
|
||||
]])
|
||||
|
||||
AT_CHECK([bison -d -v -o input.c input.y], 0, [],
|
||||
[input.y:30.6-34.5: warning: unused value: $1
|
||||
input.y:30.6-34.5: warning: unused value: $2
|
||||
input.y:30.6-34.5: warning: unused value: $5
|
||||
])
|
||||
AT_CHECK([bison -d -v -o input.c input.y], 0)
|
||||
AT_COMPILE([input])
|
||||
AT_PARSER_CHECK([./input], 0,
|
||||
[[15
|
||||
|
||||
Reference in New Issue
Block a user