commit a166d5450e3f47587b98f6005f9f5627dbe21a5b
Author: Akim Demaille <[email protected]>
Date: Tue Aug 2 08:45:25 2022 +0200
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.
diff --git a/THANKS b/THANKS
index 8ab72096..391b847e 100644
--- a/THANKS
+++ b/THANKS
@@ -46,8 +46,8 @@ Csaba Raduly [email protected]
Dagobert Michelsen [email protected]
Daniel Frużyński [email protected]
Daniel Galloway [email protected]
-Daniela Becker [email protected]
Daniel Hagerty [email protected]
+Daniela Becker [email protected]
David Barto [email protected]
David J. MacKenzie [email protected]
David Kastrup [email protected]
@@ -143,6 +143,7 @@ Nick Bowler [email protected]
Nicolas Bedon [email protected]
Nicolas Burrus [email protected]
Nicolas Tisserand [email protected]
+Nikita Popov [email protected]
Nikki Valen [email protected]
Noah Friedman [email protected]
Odd Arild Olsen [email protected]
@@ -170,7 +171,6 @@ Quoc Peyrot [email protected]
R Blake [email protected]
Raja R Harinath [email protected]
Ralf Wildenhues [email protected]
-Ryan [email protected]
Rich Wilson [email protected]
Richard Stallman [email protected]
Rici Lake [email protected]
@@ -179,6 +179,7 @@ Rob Vermaas [email protected]
Robert Anisko [email protected]
Robert Yang [email protected]
Roland Levillain [email protected]
+Ryan [email protected]
Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected]
Sebastien Fricker [email protected]
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index 240f4c36..4242b992 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -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.
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index fd7e2c33..07a523b0 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -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. */
commit 5555f4d05163316b8b5bddbdb172c0f5bae6f765
Author: Akim Demaille <[email protected]>
Date: Tue Aug 2 09:00:47 2022 +0200
regen
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 400e89b7..b6ac083e 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,9 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.8.1. */
+/* A Bison parser, made by GNU Bison 3.8.2.30-82269. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2022 Free Software
- Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2022 Free Software
Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@
USER NAME SPACE" below. */
/* Identify Bison output, and Bison version. */
-#define YYBISON 30801
+#define YYBISON 30802
/* Bison version string. */
-#define YYBISON_VERSION "3.8.1"
+#define YYBISON_VERSION "3.8.2.30-82269"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -1794,7 +1794,7 @@ static YYLTYPE yyloc_default
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
- int yynerrs = 0;
+ int yynerrs YY_ATTRIBUTE_UNUSED = 0;
yy_state_fast_t yystate = 0;
/* Number of tokens to shift before error messages enabled. */
diff --git a/src/parse-gram.h b/src/parse-gram.h
index 55837bc4..5170e08c 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.8.1. */
+/* A Bison parser, made by GNU Bison 3.8.2.30-82269. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
Foundation,
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2022 Free Software
Foundation,
Inc.
This program is free software: you can redistribute it and/or modify