[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/10] lalr1.cc: fix compiler warnings
From: |
Akim Demaille |
Subject: |
[PATCH 03/10] lalr1.cc: fix compiler warnings |
Date: |
Mon, 8 Apr 2013 20:35:49 +0200 |
Reported by Rob Conde.
http://lists.gnu.org/archive/html/bug-bison/2013-03/msg00003.html
* data/stack.hh (operator=, stack(const stack&)): Make this class
uncopyable, i.e., "undefine" these operators: make them private and
don't implement them.
(clear): New.
* data/lalr1.cc: Use it instead of an assignment.
(parser): Make this class uncopyable.
---
NEWS | 2 ++
THANKS | 1 +
data/lalr1.cc | 10 +++++++---
data/stack.hh | 8 ++++++++
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index b499cc1..ead8478 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ GNU Bison NEWS
With locations enabled, __attribute__ was used unprotected.
+*** Fix some compiler warnings (lalr1.cc)
+
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
** Bug fixes
diff --git a/THANKS b/THANKS
index 9b24974..0244a19 100644
--- a/THANKS
+++ b/THANKS
@@ -103,6 +103,7 @@ Ralf Wildenhues address@hidden
Richard Stallman address@hidden
Rob Vermaas address@hidden
Robert Anisko address@hidden
+Rob Conde address@hidden
Satya Kiran Popuri address@hidden
Sebastian Setzer address@hidden
Sebastien Fricker address@hidden
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 237b246..68de8b4 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -107,6 +107,10 @@ b4_user_stype
#endif
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[&);
+
/// Report a syntax error.
/// \param loc where the syntax error is found.
/// \param msg a description of the syntax error.
@@ -552,9 +556,9 @@ 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. */
- yystate_stack_ = state_stack_type (0);
- yysemantic_stack_ = semantic_stack_type (0);
- yylocation_stack_ = location_stack_type (0);
+ yystate_stack_.clear ();
+ yysemantic_stack_.clear ();
+ yylocation_stack_.clear ();
yysemantic_stack_.push (yylval);
yylocation_stack_.push (yylloc);
diff --git a/data/stack.hh b/data/stack.hh
index ab1049c..8f62860 100644
--- a/data/stack.hh
+++ b/data/stack.hh
@@ -77,6 +77,12 @@ b4_copyright([Stack handling for Bison parsers in C++],
seq_.pop_front ();
}
+ void
+ clear ()
+ {
+ seq_.clear ();
+ }
+
inline
unsigned int
height () const
@@ -88,6 +94,8 @@ b4_copyright([Stack handling for Bison parsers in C++],
inline const_iterator end () const { return seq_.rend (); }
private:
+ stack (const stack&);
+ stack& operator= (const stack&);
S seq_;
};
--
1.8.2
- [PATCH 00/10] {maint} Prepare 2.7.1, Akim Demaille, 2013/04/09
- [PATCH 03/10] lalr1.cc: fix compiler warnings,
Akim Demaille <=
- [PATCH 08/10] build: fix VPATH issue, Akim Demaille, 2013/04/09
- [PATCH 06/10] tests: please clang and use ".cc", not ".c", for C++ input, Akim Demaille, 2013/04/09
- [PATCH 07/10] build: avoid clang's colored diagnostics in the test suite, Akim Demaille, 2013/04/09
- [PATCH 01/10] tests: style changes, Akim Demaille, 2013/04/09
- [PATCH 04/10] skeletons: avoid empty switch constructs, Akim Demaille, 2013/04/09
- [PATCH 10/10] glr.cc: fix a clang warning, Akim Demaille, 2013/04/09
- [PATCH 02/10] yacc.c: do not use __attribute__ unprotected, Akim Demaille, 2013/04/09
- [PATCH 05/10] gnulib: update, Akim Demaille, 2013/04/09
- [PATCH 09/10] maint: update copyright years, Akim Demaille, 2013/04/09