|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83776 - in trunk/boost/spirit: home/karma/auto home/karma/binary home/karma/char home/karma/numeric home/karma/stream home/karma/string home/support repository/home/karma/nonterminal repository/home/qi/nonterminal
From: hartmut.kaiser_at_[hidden]
Date: 2013-04-06 10:36:40
Author: hkaiser
Date: 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
New Revision: 83776
URL: http://svn.boost.org/trac/boost/changeset/83776
Log:
Fix #8381: karma::uint_generator fails to compile in C++11 mode
Text files modified:
trunk/boost/spirit/home/karma/auto/auto.hpp | 2 +-
trunk/boost/spirit/home/karma/binary/binary.hpp | 2 +-
trunk/boost/spirit/home/karma/char/char.hpp | 14 +++++++-------
trunk/boost/spirit/home/karma/char/char_class.hpp | 6 +++---
trunk/boost/spirit/home/karma/numeric/bool.hpp | 2 +-
trunk/boost/spirit/home/karma/numeric/int.hpp | 6 +++---
trunk/boost/spirit/home/karma/numeric/real.hpp | 3 ++-
trunk/boost/spirit/home/karma/numeric/uint.hpp | 2 +-
trunk/boost/spirit/home/karma/stream/stream.hpp | 6 +++---
trunk/boost/spirit/home/karma/string/lit.hpp | 2 +-
trunk/boost/spirit/home/support/assert_msg.hpp | 16 +++++++++++++++-
trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp | 4 ++--
trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp | 4 ++--
13 files changed, 42 insertions(+), 27 deletions(-)
Modified: trunk/boost/spirit/home/karma/auto/auto.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auto/auto.hpp (original)
+++ trunk/boost/spirit/home/karma/auto/auto.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -90,7 +90,7 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, auto_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, auto_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/binary/binary.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/binary/binary.hpp (original)
+++ trunk/boost/spirit/home/karma/binary/binary.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -280,7 +280,7 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false,
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator,
binary_generator_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char.hpp (original)
+++ trunk/boost/spirit/home/karma/char/char.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -137,7 +137,7 @@
// providing any attribute, as the generator doesn't 'know' what
// character to output. The following assertion fires if this
// situation is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, char_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(CharParam, char_not_usable_without_attribute, ());
return false;
}
@@ -230,11 +230,11 @@
template <typename CharParam, typename Context>
bool test(unused_type, CharParam&, Context&) const
{
- // It is not possible (doesn't make sense) to use char_ generators
- // without providing any attribute, as the generator doesn't 'know'
+ // It is not possible (doesn't make sense) to use char_ generators
+ // without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(CharParam
, char_range_not_usable_without_attribute, ());
return false;
}
@@ -316,11 +316,11 @@
template <typename CharParam, typename Context>
bool test(unused_type, CharParam&, Context&) const
{
- // It is not possible (doesn't make sense) to use char_ generators
- // without providing any attribute, as the generator doesn't 'know'
+ // It is not possible (doesn't make sense) to use char_ generators
+ // without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(CharParam
, char_set_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/char/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char_class.hpp (original)
+++ trunk/boost/spirit/home/karma/char/char_class.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -95,11 +95,11 @@
template <typename CharParam, typename Context>
bool test(unused_type, CharParam&, Context&) const
{
- // It is not possible (doesn't make sense) to use char_ generators
- // without providing any attribute, as the generator doesn't 'know'
+ // It is not possible (doesn't make sense) to use char_ generators
+ // without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(CharParam
, char_class_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/numeric/bool.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/bool.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/bool.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -171,7 +171,7 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, bool_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, bool_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/int.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/int.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2012 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -41,7 +41,7 @@
namespace tag
{
template <typename T, unsigned Radix, bool force_sign>
- struct int_generator
+ struct int_generator
{
BOOST_SPIRIT_IS_TAG()
};
@@ -252,7 +252,7 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, int_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, int_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/numeric/real.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/real.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/real.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -203,7 +203,8 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, real_not_usable_without_attribute, ()); return false;
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, real_not_usable_without_attribute, ());
+ return false;
}
template <typename Context>
Modified: trunk/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/uint.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/uint.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -287,7 +287,7 @@
// without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, uint_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, uint_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/stream.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/stream.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -192,11 +192,11 @@
static bool
generate(OutputIterator&, Context&, Delimiter const&, unused_type)
{
- // It is not possible (doesn't make sense) to use stream generators
- // without providing any attribute, as the generator doesn't 'know'
+ // It is not possible (doesn't make sense) to use stream generators
+ // without providing any attribute, as the generator doesn't 'know'
// what to output. The following assertion fires if this situation
// is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, stream_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, stream_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/lit.hpp (original)
+++ trunk/boost/spirit/home/karma/string/lit.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -127,7 +127,7 @@
// providing any attribute, as the generator doesn't 'know' what
// character to output. The following assertion fires if this
// situation is detected in your code.
- BOOST_SPIRIT_ASSERT_MSG(false, string_not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, string_not_usable_without_attribute, ());
return false;
}
Modified: trunk/boost/spirit/home/support/assert_msg.hpp
==============================================================================
--- trunk/boost/spirit/home/support/assert_msg.hpp (original)
+++ trunk/boost/spirit/home/support/assert_msg.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -33,8 +33,22 @@
#define BOOST_SPIRIT_ASSERT_MATCH(Domain, Expr) \
BOOST_SPIRIT_ASSERT_MSG(( \
- boost::spirit::traits::matches<Domain, Expr>::value \
+ boost::spirit::traits::matches< Domain, Expr >::value \
), error_invalid_expression, (Expr))
+// GCC 4.7 will overeagerly instantiate static_asserts in template functions,
+// if the assert condition does not depend on template parameters
+// (see https://svn.boost.org/trac/boost/ticket/8381).
+// There are places where we want to use constant false as the condition in
+// template functions to indicate that these function overloads should never
+// be called. This allows to generate better error messages. To solve this
+// problem we make the condition dependent on the template argument and use
+// the following macro in such places.
+#include <boost/type_traits/is_same.hpp>
+
+#define BOOST_SPIRIT_ASSERT_FAIL(TemplateParam, Msg, Types) \
+ BOOST_SPIRIT_ASSERT_MSG((!boost::is_same< \
+ TemplateParam, TemplateParam >::value), Msg, Types)
+
#endif
Modified: trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp (original)
+++ trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -503,7 +503,7 @@
{
// If you are seeing a compilation error here, you are trying
// to use a subrule as a generator outside of a subrule group.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator
, subrule_used_outside_subrule_group, (id_type));
return false;
@@ -532,7 +532,7 @@
{
// If you are seeing a compilation error here, you are trying
// to use a subrule as a generator outside of a subrule group.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(OutputIterator
, subrule_used_outside_subrule_group, (id_type));
return false;
Modified: trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp (original)
+++ trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp 2013-04-06 10:36:38 EDT (Sat, 06 Apr 2013)
@@ -529,7 +529,7 @@
{
// If you are seeing a compilation error here, you are trying
// to use a subrule as a parser outside of a subrule group.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(Iterator
, subrule_used_outside_subrule_group, (id_type));
return false;
@@ -558,7 +558,7 @@
{
// If you are seeing a compilation error here, you are trying
// to use a subrule as a parser outside of a subrule group.
- BOOST_SPIRIT_ASSERT_MSG(false
+ BOOST_SPIRIT_ASSERT_FAIL(Iterator
, subrule_used_outside_subrule_group, (id_type));
return false;
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