mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
yacc.c, lalr1.cc: fix warnings about yynerrs
Most often yynerrs is not used. Clang 15 now complains about such
variables. Bison itself does not compile:
```
src/parse-gram.c:1797:9: error: variable 'gram_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
int yynerrs = 0;
^
src/parse-gram.c:79:25: note: expanded from macro 'yynerrs'
^
1 error generated.
```
Reported by Nikita Popov.
Fixes https://github.com/akimd/bison/issues/89.
* data/skeletons/yacc.c (yynerrs): Flag with YY_ATTRIBUTE_UNUSED.
* data/skeletons/lalr1.cc (yynerrs_): Likewise.
This commit is contained in:
@@ -256,7 +256,7 @@ int yynerrs;]])])
|
||||
m4_define([b4_declare_parser_state_variables],
|
||||
[b4_pure_if([[
|
||||
/* Number of syntax errors so far. */
|
||||
int yynerrs]m4_ifval([$1], [ = 0])[;
|
||||
int yynerrs YY_ATTRIBUTE_UNUSED]m4_ifval([$1], [ = 0])[;
|
||||
]])[
|
||||
yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
|
||||
/* Number of tokens to shift before error messages enabled. */
|
||||
|
||||
Reference in New Issue
Block a user