Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57505 - in trunk/libs/spirit: doc/qi example/qi test/karma test/lex test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-08 23:02:19


Author: hkaiser
Date: 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
New Revision: 57505
URL: http://svn.boost.org/trac/boost/changeset/57505

Log:
Spirit: silencing MSVC warnings
Text files modified:
   trunk/libs/spirit/doc/qi/operator.qbk | 8 ++++----
   trunk/libs/spirit/example/qi/reference.cpp | 2 +-
   trunk/libs/spirit/test/karma/bool.cpp | 2 +-
   trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp | 4 ++++
   trunk/libs/spirit/test/lex/matlib.h | 10 +++++++++-
   trunk/libs/spirit/test/lex/regression001.cpp | 2 +-
   trunk/libs/spirit/test/lex/regression004.cpp | 2 +-
   trunk/libs/spirit/test/lex/regression005.cpp | 2 +-
   trunk/libs/spirit/test/lex/semantic_actions.cpp | 6 +++---
   trunk/libs/spirit/test/lex/set_token_value.cpp | 4 ++++
   trunk/libs/spirit/test/qi/attribute.cpp | 2 +-
   trunk/libs/spirit/test/qi/expect.cpp | 14 +++++++-------
   trunk/libs/spirit/test/qi/kleene.cpp | 2 +-
   trunk/libs/spirit/test/qi/plus.cpp | 2 +-
   trunk/libs/spirit/test/qi/range_run.cpp | 6 +++---
   trunk/libs/spirit/test/qi/repeat.cpp | 2 +-
   trunk/libs/spirit/test/qi/rule_fail.cpp | 2 +-
   trunk/libs/spirit/test/qi/symbols.cpp | 4 ++++
   trunk/libs/spirit/test/qi/terminal_ex.cpp | 18 +++++++++++++++---
   trunk/libs/spirit/test/qi/tst.cpp | 2 +-
   20 files changed, 64 insertions(+), 32 deletions(-)

Modified: trunk/libs/spirit/doc/qi/operator.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi/operator.qbk (original)
+++ trunk/libs/spirit/doc/qi/operator.qbk 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -275,11 +275,11 @@
 `expectation_failure<Iter>` is thrown:
 
     template <typename Iter>
- struct expectation_failure
+ struct expectation_failure : std::runtime_error
     {
- Iter first; // [first, last) iterator pointing
- Iter last; // to the error position in the input.
- __info__ what; // Information about the nature of the error.
+ Iter first; // [first, last) iterator pointing
+ Iter last; // to the error position in the input.
+ __info__ what_; // Information about the nature of the error.
     };
 
 [heading Expression Semantics]

Modified: trunk/libs/spirit/example/qi/reference.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/reference.cpp (original)
+++ trunk/libs/spirit/example/qi/reference.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -812,7 +812,7 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: "; print_info(x.what);
+ std::cout << "expected: "; print_info(x.what_);
             std::cout << "got: \"" << std::string(x.first, x.last) << '"' << std::endl;
         }
         /*`The code above will print:[teletype]

Modified: trunk/libs/spirit/test/karma/bool.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/bool.cpp (original)
+++ trunk/libs/spirit/test/karma/bool.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -28,7 +28,7 @@
 {
     template <typename CharEncoding, typename Tag
       , typename OutputIterator>
- static bool generate_false(OutputIterator& sink, bool b)
+ static bool generate_false(OutputIterator& sink, bool)
     {
         // we want to spell the names of true and false backwards
         return boost::spirit::karma::string_inserter<CharEncoding, Tag>::

Modified: trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp (original)
+++ trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -71,6 +71,10 @@
     }
 
     std::stringstream& strm;
+
+private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ dumper& operator= (dumper const&);
 };
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: trunk/libs/spirit/test/lex/matlib.h
==============================================================================
--- trunk/libs/spirit/test/lex/matlib.h (original)
+++ trunk/libs/spirit/test/lex/matlib.h 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -30,11 +30,15 @@
     template <class Iterator,class LexerContext>
     void operator () (Iterator const& start, Iterator const& end
       , BOOST_SCOPED_ENUM(boost::spirit::lex::pass_flags)&, std::size_t
- , LexerContext &ctx) const
+ , LexerContext &) const
     {
         std::string work(start, end);
         out.push_back(std::atof(work.c_str()));
     }
+
+private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ store_double& operator= (store_double const&);
 };
 
 struct add_row
@@ -53,6 +57,10 @@
         matrix.back().swap(row);
         ctx.set_state_name("A");
     }
+
+private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ add_row& operator= (add_row const&);
 };
 
 template <class Lexer>

Modified: trunk/libs/spirit/test/lex/regression001.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression001.cpp (original)
+++ trunk/libs/spirit/test/lex/regression001.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -37,7 +37,7 @@
     token_def<> any, eol;
 };
 
-int main(int argc, char* argv[])
+int main()
 {
     // read input from the given file
     std::string str ("test");

Modified: trunk/libs/spirit/test/lex/regression004.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression004.cpp (original)
+++ trunk/libs/spirit/test/lex/regression004.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -68,7 +68,7 @@
 };
 
 
-int main(int argc, char* argv[])
+int main()
 {
     typedef lex::lexertl::token<
         const char*, boost::mpl::vector<std::string>

Modified: trunk/libs/spirit/test/lex/regression005.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression005.cpp (original)
+++ trunk/libs/spirit/test/lex/regression005.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -70,7 +70,7 @@
 typedef lex::lexertl::actor_lexer<token_type> lexer_type;
 typedef my_lexer<lexer_type>::iterator_type iterator_type;
 
-int main(int argc, char* argv[])
+int main()
 {
     std::string test_string ("BEGIN section\n");
     // we introduce a syntax error: ";;" instead of ";" as a terminator.

Modified: trunk/libs/spirit/test/lex/semantic_actions.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/semantic_actions.cpp (original)
+++ trunk/libs/spirit/test/lex/semantic_actions.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -169,9 +169,9 @@
 struct found_identifier_sa5
 {
     template <typename Context>
- void operator()(std::string::iterator& start
- , std::string::iterator& end, BOOST_SCOPED_ENUM(lex::pass_flags)& pass
- , std::size_t& id, Context& ctx)
+ void operator()(std::string::iterator& /*start*/
+ , std::string::iterator& /*end*/, BOOST_SCOPED_ENUM(lex::pass_flags)& pass
+ , std::size_t& /*id*/, Context& ctx)
     {
         BOOST_TEST(pass == lex::pass_flags::pass_normal);
 

Modified: trunk/libs/spirit/test/lex/set_token_value.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/set_token_value.cpp (original)
+++ trunk/libs/spirit/test/lex/set_token_value.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -80,6 +80,10 @@
     }
 
     std::stack<unsigned int>& indents_;
+
+private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ handle_whitespace& operator= (handle_whitespace const&);
 };
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: trunk/libs/spirit/test/qi/attribute.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/attribute.cpp (original)
+++ trunk/libs/spirit/test/qi/attribute.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -77,7 +77,7 @@
     {
         typedef int& type;
         static int& pre(test_int_data2& d) { return d.i; }
- static void post(test_int_data2& d, int const& i) {}
+ static void post(test_int_data2&, int const&) {}
     };
 }}}
 

Modified: trunk/libs/spirit/test/qi/expect.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/expect.cpp (original)
+++ trunk/libs/spirit/test/qi/expect.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -45,10 +45,10 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: "; print_info(x.what);
+ std::cout << "expected: "; print_info(x.what_);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(boost::get<std::string>(x.what.value) == "o");
+ BOOST_TEST(boost::get<std::string>(x.what_.value) == "o");
             BOOST_TEST(std::string(x.first, x.last) == "i");
         }
     }
@@ -62,10 +62,10 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: "; print_info(x.what);
+ std::cout << "expected: "; print_info(x.what_);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(boost::get<std::string>(x.what.value) == "o");
+ BOOST_TEST(boost::get<std::string>(x.what_.value) == "o");
             BOOST_TEST(std::string(x.first, x.last) == "i");
         }
     }
@@ -79,11 +79,11 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: "; print_info(x.what);
+ std::cout << "expected: "; print_info(x.what_);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(x.what.tag == "no-case-literal-string");
- BOOST_TEST(boost::get<std::string>(x.what.value) == "nend");
+ BOOST_TEST(x.what_.tag == "no-case-literal-string");
+ BOOST_TEST(boost::get<std::string>(x.what_.value) == "nend");
             BOOST_TEST(std::string(x.first, x.last) == "END");
         }
     }

Modified: trunk/libs/spirit/test/qi/kleene.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/kleene.cpp (original)
+++ trunk/libs/spirit/test/qi/kleene.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -39,7 +39,7 @@
     template <>
     struct push_back_container<x_attr, char>
     {
- static void call(x_attr& c, char val)
+ static void call(x_attr& /*c*/, char /*val*/)
         {
             // push back value type into container
         }

Modified: trunk/libs/spirit/test/qi/plus.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/plus.cpp (original)
+++ trunk/libs/spirit/test/qi/plus.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -39,7 +39,7 @@
     template <>
     struct push_back_container<x_attr, char>
     {
- static void call(x_attr& c, char val)
+ static void call(x_attr& /*c*/, char /*val*/)
         {
             // push back value type into container
         }

Modified: trunk/libs/spirit/test/qi/range_run.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/range_run.cpp (original)
+++ trunk/libs/spirit/test/qi/range_run.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -33,8 +33,8 @@
     int const test_size = 1000;
 
     boost::mt19937 rng;
- int min = const_min;
- int max = const_max;
+ Char min = const_min;
+ Char max = const_max;
     boost::uniform_int<Char> char_(min, max);
     boost::variate_generator<boost::mt19937&, boost::uniform_int<Char> >
        gen(rng, char_);
@@ -62,7 +62,7 @@
 
     for (int i = const_min; i <= int(const_max); ++i)
     {
- BOOST_TEST(rr.test(i) == bset[i-const_min]);
+ BOOST_TEST(rr.test(static_cast<Char>(i)) == bset[i-const_min]);
     }
 }
 

Modified: trunk/libs/spirit/test/qi/repeat.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/repeat.cpp (original)
+++ trunk/libs/spirit/test/qi/repeat.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -39,7 +39,7 @@
     template <>
     struct push_back_container<x_attr, char>
     {
- static void call(x_attr& c, char val)
+ static void call(x_attr& /*c*/, char /*val*/)
         {
             // push back value type into container
         }

Modified: trunk/libs/spirit/test/qi/rule_fail.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/rule_fail.cpp (original)
+++ trunk/libs/spirit/test/qi/rule_fail.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -25,7 +25,7 @@
     def = int_ >> *(',' >> int_);
 
     bool r = phrase_parse(input, end, def,
- space | ('%' >> *~char_('\n') >> '\n'));
+ qi::space | ('%' >> *~char_('\n') >> '\n'));
 
     return 0;
 }

Modified: trunk/libs/spirit/test/qi/symbols.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/symbols.cpp (original)
+++ trunk/libs/spirit/test/qi/symbols.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -55,6 +55,10 @@
 
         boost::mpl::true_ f = boost::mpl::bool_<boost::spirit::traits::is_parser<symbols<char, int> >::value>();
 
+ // silence stupid compiler warnings
+ // i.e. MSVC warning C4189: 'f' : local variable is initialized but not referenced
+ BOOST_TEST((f.value));
+
         BOOST_TEST((test("Joel", sym)));
         BOOST_TEST((test("Ruby", sym)));
         BOOST_TEST((test("Tenji", sym)));

Modified: trunk/libs/spirit/test/qi/terminal_ex.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/terminal_ex.cpp (original)
+++ trunk/libs/spirit/test/qi/terminal_ex.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -68,6 +68,10 @@
         }
 
         const T1 t1;
+
+ private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ ops_1_parser& operator= (ops_1_parser const&);
     };
 
     template <typename T1, typename T2>
@@ -117,6 +121,10 @@
 
         const T1 t1;
         const T2 t2;
+
+ private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ ops_2_parser& operator= (ops_2_parser const&);
     };
 
     template <typename T1, typename T2, typename T3>
@@ -171,6 +179,10 @@
         const T1 t1;
         const T2 t2;
         const T3 t3;
+
+ private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ ops_3_parser& operator= (ops_3_parser const&);
     };
 
 }
@@ -273,7 +285,7 @@
 namespace testns
 {
     template <typename T1, typename T>
- void check_type_1(const T& t)
+ void check_type_1(const T& /*t*/)
     {
         namespace fusion = boost::fusion;
         BOOST_STATIC_ASSERT(( boost::is_same<T
@@ -281,7 +293,7 @@
     }
 
     template <typename T1, typename T2, typename T>
- void check_type_2(const T& t)
+ void check_type_2(const T& /*t*/)
     {
         namespace fusion = boost::fusion;
         BOOST_STATIC_ASSERT(( boost::is_same<T
@@ -289,7 +301,7 @@
     }
 
     template <typename T1, typename T2, typename T3, typename T>
- void check_type_3(const T& t)
+ void check_type_3(const T& /*t*/)
     {
         namespace fusion = boost::fusion;
         BOOST_STATIC_ASSERT(( boost::is_same<T

Modified: trunk/libs/spirit/test/qi/tst.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/tst.cpp (original)
+++ trunk/libs/spirit/test/qi/tst.cpp 2009-11-08 23:02:16 EST (Sun, 08 Nov 2009)
@@ -69,7 +69,7 @@
         template <typename Char>
         Char operator()(Char ch) const
         {
- return std::tolower(ch);
+ return static_cast<Char>(std::tolower(ch));
         }
     };
 


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