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:
11
NEWS
11
NEWS
@@ -26,6 +26,17 @@ Changes in version 2.1a:
|
||||
| exp "+" exp { $$ = $1; (void) $3; }
|
||||
;
|
||||
|
||||
If there are mid-rule actions, the warning is issued if no action
|
||||
uses it. The following triggers no warning: $1 and $3 are used.
|
||||
|
||||
exp: exp { push ($1); } '+' exp { push ($3); sum (); };
|
||||
|
||||
Mid-rule actions that use $$ cause the corresponding value to be
|
||||
set, therefore the following action must use it. The following rule
|
||||
triggers a warning about $2.
|
||||
|
||||
exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
|
||||
|
||||
The warning is intended to help catching lost values and memory leaks.
|
||||
If a value is ignored, its associated memory typically is not reclaimed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user