Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54799 - in trunk/boost/spirit/home/lex: lexer qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-08 14:26:39


Author: hkaiser
Date: 2009-07-08 14:26:38 EDT (Wed, 08 Jul 2009)
New Revision: 54799
URL: http://svn.boost.org/trac/boost/changeset/54799

Log:
Spirit: fixed signed/unsigned mismatch warnings
Text files modified:
   trunk/boost/spirit/home/lex/lexer/char_token_def.hpp | 3 ++-
   trunk/boost/spirit/home/lex/lexer/string_token_def.hpp | 4 ++--
   trunk/boost/spirit/home/lex/lexer/token_def.hpp | 12 +++++++-----
   trunk/boost/spirit/home/lex/qi/state_switcher.hpp | 2 +-
   4 files changed, 12 insertions(+), 9 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/char_token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/char_token_def.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/char_token_def.hpp 2009-07-08 14:26:38 EDT (Wed, 08 Jul 2009)
@@ -61,7 +61,8 @@
     {
         typedef typename CharEncoding::char_type char_type;
 
- char_token_def(char_type ch) : ch(ch), unique_id_(~0) {}
+ char_token_def(char_type ch)
+ : ch(ch), unique_id_(std::size_t(~0)) {}
 
         template <typename LexerDef, typename String>
         void collect(LexerDef& lexdef, String const& state) const

Modified: trunk/boost/spirit/home/lex/lexer/string_token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/string_token_def.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/string_token_def.hpp 2009-07-08 14:26:38 EDT (Wed, 08 Jul 2009)
@@ -58,13 +58,13 @@
         typedef std::basic_string<char_type> string_type;
 
         string_token_def(typename add_reference<String>::type str)
- : str_(str), id_(~0U) {}
+ : str_(str), id_(std::size_t(~0)) {}
 
         template <typename LexerDef, typename State>
         void collect(LexerDef& lexdef, State const& state) const
         {
             typedef typename LexerDef::id_type id_type;
- if (~0U == id_)
+ if (std::size_t(~0) == id_)
                 id_ = next_id<id_type>::get();
             unique_id_ = lexdef.add_token (state.c_str(), str_, id_);
         }

Modified: trunk/boost/spirit/home/lex/lexer/token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/token_def.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/token_def.hpp 2009-07-08 14:26:38 EDT (Wed, 08 Jul 2009)
@@ -125,7 +125,7 @@
 
                 // If the following assertion fires you probably forgot to
                 // associate this token definition with a lexer instance.
- BOOST_ASSERT((std::size_t)(~0) != token_state_);
+ BOOST_ASSERT(std::size_t(~0) != token_state_);
 
                 token_type &t = *first;
                 if (token_id_ == t.id() && token_state_ == t.state()) {
@@ -156,7 +156,7 @@
             // is not possible. Please create a separate token_def instance
             // from the same regular expression for each lexer state it needs
             // to be associated with.
- BOOST_ASSERT(~0 == token_state_ || state_id == token_state_);
+ BOOST_ASSERT(std::size_t(~0) == token_state_ || state_id == token_state_);
 
             token_state_ = state_id;
             if (0 == token_id_)
@@ -183,16 +183,18 @@
         // Lex interface: constructing token definitions
         token_def()
           : proto_base_type(terminal_type::make(alias()))
- , def_('\0'), token_id_(), unique_id_(~0), token_state_(~0) {}
+ , def_('\0'), token_id_()
+ , unique_id_(std::size_t(~0)), token_state_(~0) {}
 
         explicit token_def(char_type def_, Idtype id_ = Idtype())
           : proto_base_type(terminal_type::make(alias()))
           , def_(def_), token_id_(Idtype() == id_ ? def_ : id_)
- , unique_id_(~0), token_state_(~0) {}
+ , unique_id_(~0), token_state_(std::size_t(~0)) {}
 
         explicit token_def(string_type const& def_, Idtype id_ = Idtype())
           : proto_base_type(terminal_type::make(alias()))
- , def_(def_), token_id_(id_), unique_id_(~0), token_state_(~0) {}
+ , def_(def_), token_id_(id_)
+ , unique_id_(std::size_t(~0)), token_state_(std::size_t(~0)) {}
 
         template <typename String>
         token_def& operator= (String const& definition)

Modified: trunk/boost/spirit/home/lex/qi/state_switcher.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/qi/state_switcher.hpp (original)
+++ trunk/boost/spirit/home/lex/qi/state_switcher.hpp 2009-07-08 14:26:38 EDT (Wed, 08 Jul 2009)
@@ -77,7 +77,7 @@
             // set_state(...) or in_state(...)[...] lexer state switcher with
             // a lexer state name unknown to the lexer (no token definitions
             // have been associated with this lexer state).
- BOOST_ASSERT(static_cast<std::size_t>(~0) != state);
+ BOOST_ASSERT(std::size_t(~0) != state);
             return it.set_state(state);
         }
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk