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:
Akim Demaille
2022-08-02 08:45:25 +02:00
parent b7bdf78c18
commit a166d5450e
3 changed files with 5 additions and 4 deletions

View File

@@ -847,7 +847,7 @@ m4_if(b4_prefix, [yy], [],
int yylen = 0;
// Error handling.
int yynerrs_ = 0;
int yynerrs_ YY_ATTRIBUTE_UNUSED = 0;
int yyerrstatus_ = 0;
/// The lookahead symbol.