commit a166d5450e3f47587b98f6005f9f5627dbe21a5b Author: Akim Demaille <akim.demai...@gmail.com> 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 csaba...@yahoo.co.uk Dagobert Michelsen d...@baltic-online.de Daniel Frużyński dan...@poradnik-webmastera.com Daniel Galloway dg1...@att.com -Daniela Becker dani...@lrde.epita.fr Daniel Hagerty h...@gnu.org +Daniela Becker dani...@lrde.epita.fr David Barto david.ba...@sparqlcity.com David J. MacKenzie d...@gnu.org David Kastrup d...@gnu.org @@ -143,6 +143,7 @@ Nick Bowler nbow...@elliptictech.com Nicolas Bedon nicolas.be...@univ-rouen.fr Nicolas Burrus nicolas.bur...@epita.fr Nicolas Tisserand nicolas.tisser...@epita.fr +Nikita Popov ni...@php.net Nikki Valen nicolettavalencia...@gmail.com Noah Friedman fried...@gnu.org Odd Arild Olsen o...@fibula.no @@ -170,7 +171,6 @@ Quoc Peyrot cho...@lrde.epita.fr R Blake blak...@mac.com Raja R Harinath harin...@cs.umn.edu Ralf Wildenhues ralf.wildenh...@gmx.de -Ryan d...@splintermail.com Rich Wilson ric...@gmail.com Richard Stallman r...@gnu.org Rici Lake ricil...@gmail.com @@ -179,6 +179,7 @@ Rob Vermaas rob.verm...@gmail.com Robert Anisko anisk...@epita.fr Robert Yang liezhi.y...@windriver.com Roland Levillain rol...@lrde.epita.fr +Ryan d...@splintermail.com Satya Kiran Popuri satyaki...@gmail.com Sebastian Setzer sebastian.setzer....@siemens.com Sebastien Fricker sebastien.fric...@gmail.com 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 <akim.demai...@gmail.com> 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