diff options
author | Theophile Ranquet <ranquet@lrde.epita.fr> | 2013-01-11 11:41:07 +0100 |
---|---|---|
committer | Theophile Ranquet <ranquet@lrde.epita.fr> | 2013-01-11 18:57:09 +0100 |
commit | 04816a6f3203968479591ebbe1886537674fa110 (patch) | |
tree | a2a3b97640494e34e3527f269c0d0fae696530f0 | |
parent | 39ad6cc6acde293499c9501a3bfcb6ac64bdad22 (diff) | |
download | bison-04816a6f3203968479591ebbe1886537674fa110.tar.gz |
c++: privatize variant blind copies
* 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.
-rw-r--r-- | data/c++.m4 | 11 | ||||
-rw-r--r-- | data/glr.cc | 1 | ||||
-rw-r--r-- | data/lalr1.cc | 1 | ||||
-rw-r--r-- | data/variant.hh | 2 |
4 files changed, 14 insertions, 1 deletions
diff --git a/data/c++.m4 b/data/c++.m4 index 020160c9..4fb28051 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -186,6 +186,9 @@ m4_define([b4_public_types_declare], [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); @@ -252,6 +255,14 @@ m4_define([b4_public_types_define], 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) : Base (other) , value ()]b4_locations_if([ diff --git a/data/glr.cc b/data/glr.cc index 7e42346c..3f46c95d 100644 --- a/data/glr.cc +++ b/data/glr.cc @@ -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]])[ +#include <cstdlib> // abort #include <stdexcept> #include <string> #include <iostream>]b4_defines_if([ diff --git a/data/lalr1.cc b/data/lalr1.cc index 40446b71..178b8fa9 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -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>])[ +# include <cstdlib> // abort # include <vector> # include <iostream> # include <stdexcept> diff --git a/data/variant.hh b/data/variant.hh index 184485c6..4317abaf 100644 --- a/data/variant.hh +++ b/data/variant.hh @@ -203,7 +203,7 @@ m4_define([b4_variant_define], } /// Prohibit blind copies. - // private: + private: self_type& operator=(const self_type&) { abort (); |