Hi Frank! > Le 30 juin 2019 à 02:26, Frank Heckenbach <f.heckenb...@fh-soft.de> a écrit : > > [...] > > So I looked in the generated file and found this: > > // ... > > /* Suppress unused-variable warnings by "using" E. */ > #if ! defined lint || defined __GNUC__ > # define YYUSE(E) ((void) (E)) > #else > # define YYUSE(E) /* empty */ > #endif > > // ... > > // Suppress unused-variable warnings by "using" E. > #define YYUSE(E) ((void) (E)) > > // ... > > YYUSE (yysym.type_get ()); > > So YYUSE is in fact used, but after being defined twice.
Nice one :) Thanks for reporting this! The C++ skeletons now indeed benefit from the definition in C. > However, as far as Bison is concerned, I wonder if it's actually > intended that the macro is defined twice, and in fact both > definitions might differ, depending on the conditionals. Yes, I agree, it's wrong. > AFAICS, the two definitions come from c.m4 and lalr1.cc, > respectively. Since the latter uses the former (via c++.m4), it > seems the second one can safely be removed. I just tested it with > split-header and single-file parsers and found no difference, except > for the above warning disappearing. Bison's test suite is also happy with this change. Thanks a lot! commit afc219a7657a482fedad8ded786f3400f8ea105f Author: Akim Demaille <akim.demai...@gmail.com> Date: Sun Jun 30 19:19:43 2019 +0200 c++: avoid duplicate definition of YYUSE Reported by Frank Heckenbach. https://lists.gnu.org/archive/html/bug-bison/2019-06/msg00009.html * data/skeletons/lalr1.cc (b4_shared_declarations): Remove the duplicate definition of YYUSE, the other one coming from b4_attribute_define. diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index ef5d76f5..d1c30403 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -459,9 +459,6 @@ m4_if(b4_prefix, [yy], [], [#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) ]b4_yylloc_default_define])[ -// Suppress unused-variable warnings by "using" E. -#define YYUSE(E) ((void) (E)) - // Enable debugging if requested. #if ]b4_api_PREFIX[DEBUG