]> git.saurik.com Git - bison.git/commitdiff
c++: privatize variant blind copies
authorTheophile Ranquet <ranquet@lrde.epita.fr>
Fri, 11 Jan 2013 10:41:07 +0000 (11:41 +0100)
committerTheophile Ranquet <ranquet@lrde.epita.fr>
Fri, 11 Jan 2013 17:57:09 +0000 (18:57 +0100)
* data/variant.hh (variant, operator=): Make private.
* data/c++.m4 (operator=): New, to avoid needing a definition of that operator
for each class member (such as a possible variant).
* data/glr.cc, data/lalr.cc: Add the necessary include for the abort.

data/c++.m4
data/glr.cc
data/lalr1.cc
data/variant.hh

index 020160c9b85fc0d5f0a54253b50eca4ba1e56109..4fb280517b19960660cc43267e8d27a4d53df5cc 100644 (file)
@@ -186,6 +186,9 @@ m4_define([b4_public_types_declare],
         [const semantic_type& v],
         b4_locations_if([const location_type& l]))[);
 
         [const semantic_type& v],
         b4_locations_if([const location_type& l]))[);
 
+      /// Assignment operator.
+      inline basic_symbol& operator= (const basic_symbol& other);
+
       /// Destructive move, \a s is emptied.
       inline void move (basic_symbol& s);
 
       /// Destructive move, \a s is emptied.
       inline void move (basic_symbol& s);
 
@@ -250,6 +253,14 @@ m4_define([b4_public_types_define],
     , location (l)
   {}])[
 
     , location (l)
   {}])[
 
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>&
+  ]b4_parser_class_name[::basic_symbol<Base>::operator= (const basic_symbol& other)
+  {
+    abort ();
+  }
+
   template <typename Base>
   inline
   ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
   template <typename Base>
   inline
   ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
index 7e42346ccd371bb2029c28c4ada0bdd05621f181..3f46c95d40dcd0e49d70776833c35842e9bf27df 100644 (file)
@@ -253,6 +253,7 @@ m4_define([b4_shared_declarations],
 [m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
 b4_percent_code_get([[requires]])[
 
 [m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
 b4_percent_code_get([[requires]])[
 
+#include <cstdlib>  // abort
 #include <stdexcept>
 #include <string>
 #include <iostream>]b4_defines_if([
 #include <stdexcept>
 #include <string>
 #include <iostream>]b4_defines_if([
index 40446b7198ca46727ba90d32d90379902c395690..178b8fa992e8d7428e4939f50a54c16c96cab011 100644 (file)
@@ -146,6 +146,7 @@ b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
 m4_define([b4_shared_declarations],
 [b4_percent_code_get([[requires]])[
 ]b4_parse_assert_if([# include <cassert>])[
 m4_define([b4_shared_declarations],
 [b4_percent_code_get([[requires]])[
 ]b4_parse_assert_if([# include <cassert>])[
+# include <cstdlib>  // abort
 # include <vector>
 # include <iostream>
 # include <stdexcept>
 # include <vector>
 # include <iostream>
 # include <stdexcept>
index 184485c661b1f7112fd91589d94d23d40c34660d..4317abaf489009e671defb89c0b679f2e7a0f4e9 100644 (file)
@@ -203,7 +203,7 @@ m4_define([b4_variant_define],
     }
 
     /// Prohibit blind copies.
     }
 
     /// Prohibit blind copies.
-    //  private:
+    private:
     self_type& operator=(const self_type&)
     {
       abort ();
     self_type& operator=(const self_type&)
     {
       abort ();