From cbbbe12e023a34352881fa7f0d597c7b2342eaad Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 26 Apr 2020 08:01:33 +0200 Subject: [PATCH] c++: fix a few style issues * data/skeletons/lalr1.cc (yystack_print_, yy_reduce_print_): Add missing const. (yystack_print_): Rename as... (yy_stack_print_): this. * data/skeletons/glr.cc (yy_symbol_value_print_, yy_symbol_print_): Add missing const. --- data/skeletons/glr.cc | 10 +++++----- data/skeletons/lalr1.cc | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc index b5f46ccd..05c9f3eb 100644 --- a/data/skeletons/glr.cc +++ b/data/skeletons/glr.cc @@ -167,7 +167,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl void ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind, const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[) + const location_type* yylocationp]])[) const {]b4_locations_if([[ YYUSE (yylocationp);]])[ YYUSE (yyvaluep); @@ -181,7 +181,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl void ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind, const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[) + const location_type* yylocationp]])[) const { *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm") << ' ' << yytname[yykind] << " ("]b4_locations_if([[ @@ -317,16 +317,16 @@ b4_percent_code_get([[requires]])[ /// \param yylocationp Its location.]])[ virtual void yy_symbol_value_print_ (symbol_kind_type yykind, const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[); + const location_type* yylocationp]])[) const; /// \brief Report a symbol on the debug stream. /// \param yykind The symbol kind. /// \param yyvaluep Its semantic value.]b4_locations_if([[ /// \param yylocationp Its location.]])[ virtual void yy_symbol_print_ (symbol_kind_type yykind, const semantic_type* yyvaluep]b4_locations_if([[, - const location_type* yylocationp]])[); + const location_type* yylocationp]])[) const; private: - // Debugging. + /// Debug stream. std::ostream* yycdebug_; #endif diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index ca75acf3..a44090af 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -331,9 +331,9 @@ m4_define([b4_shared_declarations], ]b4_integral_parser_table_declare([rline], [b4_rline], [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[ /// Report on the debug stream that the rule \a r is going to be reduced. - virtual void yy_reduce_print_ (int r); + virtual void yy_reduce_print_ (int r) const; /// Print the state stack on the debug stream. - virtual void yystack_print_ (); + virtual void yy_stack_print_ () const; /// Debugging level. int yydebug_; @@ -567,7 +567,7 @@ m4_if(b4_prefix, [yy], [], # define YY_STACK_PRINT() \ do { \ if (yydebug_) \ - yystack_print_ (); \ + yy_stack_print_ (); \ } while (false) #else // !]b4_api_PREFIX[DEBUG @@ -1538,7 +1538,7 @@ b4_dollar_popdef])[]dnl ]b4_integral_parser_table_define([rline], [b4_rline])[ void - ]b4_parser_class[::yystack_print_ () + ]b4_parser_class[::yy_stack_print_ () const { *yycdebug_ << "Stack now"; for (stack_type::const_iterator @@ -1550,7 +1550,7 @@ b4_dollar_popdef])[]dnl } void - ]b4_parser_class[::yy_reduce_print_ (int yyrule) + ]b4_parser_class[::yy_reduce_print_ (int yyrule) const { int yylno = yyrline_[yyrule]; int yynrhs = yyr2_[yyrule];