Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58870 - trunk/boost/spirit/home/lex/lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-10 11:08:21


Author: hkaiser
Date: 2010-01-10 11:08:21 EST (Sun, 10 Jan 2010)
New Revision: 58870
URL: http://svn.boost.org/trac/boost/changeset/58870

Log:
Spirit: working around false static assert on earlier versions of gcc
Text files modified:
   trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp | 7 +++++++
   trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp | 7 +++++++
   2 files changed, 14 insertions(+), 0 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp 2010-01-10 11:08:21 EST (Sun, 10 Jan 2010)
@@ -62,11 +62,18 @@
             template <typename Char>
             void set_state_name (Char const*)
             {
+// earlier versions of gcc (< 4.2.2) instantiate this function even if it's not
+// needed leading to false static asserts
+#if !(defined(__GNUC__) && ( \
+ (__GNUC__ < 4) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2)) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ == 2) && (__GNUC_PATCHLEVEL__ < 2))))
                 // If you see a compile time assertion below you're probably
                 // using a token type not supporting lexer states (the 3rd
                 // template parameter of the token is mpl::false_), but your
                 // code uses state changes anyways.
                 BOOST_STATIC_ASSERT(false);
+#endif
             }
             char_type const* get_state_name() const { return rules_.initial(); }
             std::size_t get_state_id (char_type const*) const

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp 2010-01-10 11:08:21 EST (Sun, 10 Jan 2010)
@@ -78,11 +78,18 @@
             template <typename Char>
             void set_state_name (Char const*)
             {
+// earlier versions of gcc (< 4.2.2) instantiate this function even if it's not
+// needed leading to false static asserts
+#if !(defined(__GNUC__) && ( \
+ (__GNUC__ < 4) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2)) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ == 2) && (__GNUC_PATCHLEVEL__ < 2))))
                 // If you see a compile time assertion below you're probably
                 // using a token type not supporting lexer states (the 3rd
                 // template parameter of the token is mpl::false_), but your
                 // code uses state changes anyways.
                 BOOST_STATIC_ASSERT(false);
+#endif
             }
             char_type const* get_state_name() const
             {


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