mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: use modern idioms to make classes non-copyable
Reported by Don Macpherson. https://lists.gnu.org/r/bug-bison/2019-05/msg00015.html https://github.com/akimd/bison/issues/36 * data/skeletons/lalr1.cc, data/skeletons/stack.hh, * data/skeletons/variant.hh: Delete the copy-ctor and the copy operator.
This commit is contained in:
@@ -204,6 +204,13 @@ m4_define([b4_shared_declarations],
|
||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class[ ();
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
]b4_parser_class[ (const ]b4_parser_class[&) = delete;
|
||||
/// Non copyable.
|
||||
]b4_parser_class[& operator= (const ]b4_parser_class[&) = delete;
|
||||
#endif
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
@@ -255,10 +262,13 @@ m4_define([b4_shared_declarations],
|
||||
};
|
||||
]])[
|
||||
private:
|
||||
/// This class is not copyable.
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
]b4_parser_class[ (const ]b4_parser_class[&);
|
||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);]b4_lac_if([[
|
||||
|
||||
/// Non copyable.
|
||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);
|
||||
#endif
|
||||
]b4_lac_if([[
|
||||
/// Check the lookahead yytoken.
|
||||
/// \returns true iff the token will be eventually shifted.
|
||||
bool yy_lac_check_ (symbol_kind_type yytoken) const;
|
||||
|
||||
Reference in New Issue
Block a user