Ticket #8381: spirit_static_assert.patch

File spirit_static_assert.patch, 12.3 KB (added by Andrey Semashev, 10 years ago)

The patch fixes the problem by changing the assert condition.

  • boost/spirit/home/karma/char/char.hpp

     
    137137            // providing any attribute, as the generator doesn't 'know' what
    138138            // character to output. The following assertion fires if this
    139139            // situation is detected in your code.
    140             BOOST_SPIRIT_ASSERT_MSG(false, char_not_usable_without_attribute, ());
     140            BOOST_SPIRIT_ASSERT_FAIL(CharParam, char_not_usable_without_attribute, ());
    141141            return false;
    142142        }
    143143
     
    230230        template <typename CharParam, typename Context>
    231231        bool test(unused_type, CharParam&, Context&) const
    232232        {
    233             // It is not possible (doesn't make sense) to use char_ generators 
    234             // without providing any attribute, as the generator doesn't 'know' 
     233            // It is not possible (doesn't make sense) to use char_ generators
     234            // without providing any attribute, as the generator doesn't 'know'
    235235            // what to output. The following assertion fires if this situation
    236236            // is detected in your code.
    237             BOOST_SPIRIT_ASSERT_MSG(false
     237            BOOST_SPIRIT_ASSERT_FAIL(CharParam
    238238              , char_range_not_usable_without_attribute, ());
    239239            return false;
    240240        }
     
    316316        template <typename CharParam, typename Context>
    317317        bool test(unused_type, CharParam&, Context&) const
    318318        {
    319             // It is not possible (doesn't make sense) to use char_ generators 
    320             // without providing any attribute, as the generator doesn't 'know' 
     319            // It is not possible (doesn't make sense) to use char_ generators
     320            // without providing any attribute, as the generator doesn't 'know'
    321321            // what to output. The following assertion fires if this situation
    322322            // is detected in your code.
    323             BOOST_SPIRIT_ASSERT_MSG(false
     323            BOOST_SPIRIT_ASSERT_FAIL(CharParam
    324324               , char_set_not_usable_without_attribute, ());
    325325            return false;
    326326        }
  • boost/spirit/home/karma/char/char_class.hpp

     
    9595        template <typename CharParam, typename Context>
    9696        bool test(unused_type, CharParam&, Context&) const
    9797        {
    98             // It is not possible (doesn't make sense) to use char_ generators 
    99             // without providing any attribute, as the generator doesn't 'know' 
     98            // It is not possible (doesn't make sense) to use char_ generators
     99            // without providing any attribute, as the generator doesn't 'know'
    100100            // what to output. The following assertion fires if this situation
    101101            // is detected in your code.
    102             BOOST_SPIRIT_ASSERT_MSG(false
     102            BOOST_SPIRIT_ASSERT_FAIL(CharParam
    103103              , char_class_not_usable_without_attribute, ());
    104104            return false;
    105105        }
  • boost/spirit/home/karma/numeric/real.hpp

     
    203203            // without providing any attribute, as the generator doesn't 'know'
    204204            // what to output. The following assertion fires if this situation
    205205            // is detected in your code.
    206             BOOST_SPIRIT_ASSERT_MSG(false, real_not_usable_without_attribute, ());            return false;
     206            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, real_not_usable_without_attribute, ());
     207            return false;
    207208        }
    208209
    209210        template <typename Context>
  • boost/spirit/home/karma/numeric/int.hpp

     
    252252            // without providing any attribute, as the generator doesn't 'know'
    253253            // what to output. The following assertion fires if this situation
    254254            // is detected in your code.
    255             BOOST_SPIRIT_ASSERT_MSG(false, int_not_usable_without_attribute, ());
     255            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, int_not_usable_without_attribute, ());
    256256            return false;
    257257        }
    258258
  • boost/spirit/home/karma/numeric/bool.hpp

     
    171171            // without providing any attribute, as the generator doesn't 'know'
    172172            // what to output. The following assertion fires if this situation
    173173            // is detected in your code.
    174             BOOST_SPIRIT_ASSERT_MSG(false, bool_not_usable_without_attribute, ());
     174            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, bool_not_usable_without_attribute, ());
    175175            return false;
    176176        }
    177177
  • boost/spirit/home/karma/numeric/uint.hpp

     
    287287            // without providing any attribute, as the generator doesn't 'know'
    288288            // what to output. The following assertion fires if this situation
    289289            // is detected in your code.
    290             BOOST_SPIRIT_ASSERT_MSG(false, uint_not_usable_without_attribute, ());
     290            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, uint_not_usable_without_attribute, ());
    291291            return false;
    292292        }
    293293
  • boost/spirit/home/karma/string/lit.hpp

     
    127127            // providing any attribute, as the generator doesn't 'know' what
    128128            // character to output. The following assertion fires if this
    129129            // situation is detected in your code.
    130             BOOST_SPIRIT_ASSERT_MSG(false, string_not_usable_without_attribute, ());
     130            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, string_not_usable_without_attribute, ());
    131131            return false;
    132132        }
    133133
  • boost/spirit/home/karma/binary/binary.hpp

     
    280280            // without providing any attribute, as the generator doesn't 'know'
    281281            // what to output. The following assertion fires if this situation
    282282            // is detected in your code.
    283             BOOST_SPIRIT_ASSERT_MSG(false,
     283            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator,
    284284                binary_generator_not_usable_without_attribute, ());
    285285            return false;
    286286        }
  • boost/spirit/home/karma/stream/stream.hpp

     
    192192        static bool
    193193        generate(OutputIterator&, Context&, Delimiter const&, unused_type)
    194194        {
    195             // It is not possible (doesn't make sense) to use stream generators 
    196             // without providing any attribute, as the generator doesn't 'know' 
     195            // It is not possible (doesn't make sense) to use stream generators
     196            // without providing any attribute, as the generator doesn't 'know'
    197197            // what to output. The following assertion fires if this situation
    198198            // is detected in your code.
    199             BOOST_SPIRIT_ASSERT_MSG(false, stream_not_usable_without_attribute, ());
     199            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, stream_not_usable_without_attribute, ());
    200200            return false;
    201201        }
    202202
  • boost/spirit/home/karma/auto/auto.hpp

     
    9090            // without providing any attribute, as the generator doesn't 'know'
    9191            // what to output. The following assertion fires if this situation
    9292            // is detected in your code.
    93             BOOST_SPIRIT_ASSERT_MSG(false, auto_not_usable_without_attribute, ());
     93            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, auto_not_usable_without_attribute, ());
    9494            return false;
    9595        }
    9696
  • boost/spirit/home/support/assert_msg.hpp

     
    3333
    3434#define BOOST_SPIRIT_ASSERT_MATCH(Domain, Expr)                               \
    3535        BOOST_SPIRIT_ASSERT_MSG((                                             \
    36             boost::spirit::traits::matches<Domain, Expr>::value               \
     36            boost::spirit::traits::matches< Domain, Expr >::value             \
    3737        ), error_invalid_expression, (Expr))
    3838
     39// GCC 4.7 will overeagerly instantiate static_asserts in template functions, if the assert condition
     40// does not depend on template parameters (see https://svn.boost.org/trac/boost/ticket/8381).
     41// There are places where we want to use constant false as the condition in template functions
     42// to indicate that these function overloads should never be called. This allows to generate
     43// better error messages. To solve this problem we make the condition dependent on the template argument
     44// and use the following macro in such places.
     45#include <boost/type_traits/is_same.hpp>
     46
     47#define BOOST_SPIRIT_ASSERT_FAIL(TemplateParam, Msg, Types) \
     48        BOOST_SPIRIT_ASSERT_MSG((!boost::is_same< TemplateParam, TemplateParam >::value), Msg, Types)
     49
    3950#endif
    4051
  • boost/spirit/repository/home/qi/nonterminal/subrule.hpp

     
    529529        {
    530530            // If you are seeing a compilation error here, you are trying
    531531            // to use a subrule as a parser outside of a subrule group.
    532             BOOST_SPIRIT_ASSERT_MSG(false
     532            BOOST_SPIRIT_ASSERT_FAIL(Iterator
    533533              , subrule_used_outside_subrule_group, (id_type));
    534534
    535535            return false;
     
    558558        {
    559559            // If you are seeing a compilation error here, you are trying
    560560            // to use a subrule as a parser outside of a subrule group.
    561             BOOST_SPIRIT_ASSERT_MSG(false
     561            BOOST_SPIRIT_ASSERT_FAIL(Iterator
    562562              , subrule_used_outside_subrule_group, (id_type));
    563563
    564564            return false;
  • boost/spirit/repository/home/karma/nonterminal/subrule.hpp

     
    503503        {
    504504            // If you are seeing a compilation error here, you are trying
    505505            // to use a subrule as a generator outside of a subrule group.
    506             BOOST_SPIRIT_ASSERT_MSG(false
     506            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator
    507507              , subrule_used_outside_subrule_group, (id_type));
    508508
    509509            return false;
     
    532532        {
    533533            // If you are seeing a compilation error here, you are trying
    534534            // to use a subrule as a generator outside of a subrule group.
    535             BOOST_SPIRIT_ASSERT_MSG(false
     535            BOOST_SPIRIT_ASSERT_FAIL(OutputIterator
    536536              , subrule_used_outside_subrule_group, (id_type));
    537537
    538538            return false;