Disable unset/unused mid-rule value warnings by default, and recognize

--warnings=midrule-values to enable them.  Discussed starting at
<http://lists.gnu.org/archive/html/help-bison/2006-10/msg00030.html>.
* NEWS (2.3a+): Mention.
* src/getargs.c, src/getargs.h (warnings_args, warnings_types, enum
warnings): Add entry for midrule-values subargument.
* src/reader.c (symbol_should_be_used): Don't return true just because
the value is a set/used mid-rule value unless
--warnings=midrule-values was specified.
* tests/input.at (Unused values, Unused values before symbol
declarations): Run tests with and without --warnings=midrule-values.

* src/reader.c (check_and_convert_grammar): Use symbol_list_free rather
than LIST_FREE directly.
This commit is contained in:
Joel E. Denny
2006-11-01 06:09:40 +00:00
parent 89eb3c7653
commit 17bd8a736a
6 changed files with 81 additions and 32 deletions

20
NEWS
View File

@@ -6,6 +6,26 @@ Changes in version 2.3a+ (????-??-??):
* The -g and --graph options now output graphs in Graphviz DOT format,
not VCG format.
* Revised warning: unset or unused mid-rule values
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
used within any of the actions of the parent rule. For example, Bison warns
about unused $2 in:
exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
Now, Bison also warns about mid-rule values that are used but not set. For
example, Bison warns about unset $$ in the mid-rule action in:
exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
However, Bison now disables both of these warnings by default since they
sometimes prove to be false alarms in existing grammars employing the Yacc
constructs $0 or $-N (where N is some positive integer).
To enable these warnings, specify the flag `--warnings=midrule-values' or
`-W', which is a synonym for `--warnings=all'.
* Bison now recognizes two separate kinds of default %destructor's and
%printer's: