]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
c++: use __attribute__((__pure__)) to avoid warnings
[bison.git] / data / lalr1.cc
index 4eec878abdf9295ec477cf39b6430800803637fb..cb61ebb77292e385222a4d535cdafe2d2c4ab384 100644 (file)
@@ -40,7 +40,6 @@ m4_define([b4_integral_parser_table_define],
   };dnl
 ])
 
-
 # b4_symbol_value_template(VAL, [TYPE])
 # -------------------------------------
 # Same as b4_symbol_value, but used in a template method.  It makes
@@ -158,6 +157,7 @@ m4_define([b4_shared_declarations],
 ]b4_bison_locations_if([[# include "location.hh"]])])[
 ]b4_variant_if([b4_variant_includes])[
 
+]b4_attribute_define[
 ]b4_YYDEBUG_define[
 
 ]b4_namespace_open[
@@ -184,14 +184,14 @@ b4_location_define])])[
 
 #if ]b4_api_PREFIX[DEBUG
     /// The current debugging stream.
-    std::ostream& debug_stream () const;
+    std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
     /// Set the current debugging stream.
     void set_debug_stream (std::ostream &);
 
     /// Type for debugging levels.
     typedef int debug_level_type;
     /// The current debugging level.
-    debug_level_type debug_level () const;
+    debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
     /// Set the current debugging level.
     void set_debug_level (debug_level_type l);
 #endif
@@ -205,6 +205,10 @@ b4_location_define])])[
     void error (const syntax_error& err);
 
   private:
+    /// This class is not copyable.
+    ]b4_parser_class_name[ (const ]b4_parser_class_name[&);
+    ]b4_parser_class_name[& operator= (const ]b4_parser_class_name[&);
+
     /// State numbers.
     typedef int state_type;
 
@@ -264,7 +268,7 @@ b4_location_define])])[
     /// \brief Reclaim the memory associated to a symbol.
     /// \param yymsg     Why this token is reclaimed.
     ///                  If null, print nothing.
-    /// \param s         The symbol.
+    /// \param yysym     The symbol.
     template <typename Base>
     void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
 
@@ -338,13 +342,13 @@ b4_location_define])])[
     enum
     {
       yyeof_ = 0,
-      yylast_ = ]b4_last[,           //< Last index in yytable_.
-      yynnts_ = ]b4_nterms_number[,  //< Number of nonterminal symbols.
+      yylast_ = ]b4_last[,     ///< Last index in yytable_.
+      yynnts_ = ]b4_nterms_number[,  ///< Number of nonterminal symbols.
       yyempty_ = -2,
-      yyfinal_ = ]b4_final_state_number[, //< Termination state number.
+      yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
       yyterror_ = 1,
       yyerrcode_ = 256,
-      yyntokens_ = ]b4_tokens_number[    //< Number of tokens.
+      yyntokens_ = ]b4_tokens_number[  ///< Number of tokens.
     };
 
 ]b4_parse_param_vars[
@@ -595,13 +599,7 @@ m4_if(b4_prefix, [yy], [],
       YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
 
     // User destructor.
-    symbol_number_type yytype = yysym.type_get ();
-    switch (yytype)
-      {
-]b4_symbol_foreach([b4_symbol_destructor])dnl
-[       default:
-          break;
-      }])[
+    b4_symbol_actions([destructor], [yysym.type_get ()])])[
   }
 
 #if ]b4_api_PREFIX[DEBUG
@@ -616,12 +614,7 @@ m4_if(b4_prefix, [yy], [],
     yyo << (yytype < yyntokens_ ? "token" : "nterm")
         << ' ' << yytname_[yytype] << " ("]b4_locations_if([
         << yysym.location << ": "])[;
-    switch (yytype)
-      {
-]b4_symbol_foreach([b4_symbol_printer])dnl
-[       default:
-          break;
-      }
+    ]b4_symbol_actions([printer])[
     yyo << ')';
   }
 #endif
@@ -741,7 +734,7 @@ b4_dollar_popdef])[]dnl
        yynewstate, since the latter expects the semantical and the
        location values to have been already stored, initialize these
        stacks with a primary value.  */
-    yystack_ = stack_type (0);
+    yystack_.clear ();
     yypush_ (YY_NULL, 0, yyla);
 
     // A new symbol was pushed on the stack.