gpt4 book ai didi

C++ 编译器在使用 boost::xpressive 时给出警告页面

转载 作者:行者123 更新时间:2023-11-30 04:32:26 26 4
gpt4 key购买 nike

我在尝试使用 boost::xpressive 时收到一长串编译警告;特别是当我使用 sregex_compilercompile() 函数时。

我关注了 documentation并将这个小程序放在一起:

#include <iostream>
#include <boost/xpressive/xpressive.hpp>

using namespace std;

int main (int argc, char **argv)
{
bool matchResult;
boost::xpressive::sregex_compiler compiler;
boost::xpressive::sregex re;
string str("hello world");

re = compiler.compile("hello"); // <-- this line causes warnings

matchResult = boost::xpressive::regex_search(str, re);
cout << "match result = " << matchResult << endl;

return 0;
}

当我编译时,我收到一大堆警告:

$ g++ -I /usr/local/include -o simple xpressive_simple.cc 
/usr/local/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp: In instantiation of 'boost::xpressive::detail::alternate_matcher<boost::xpressive::detail::alternates_vector<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >':
/usr/local/include/boost/xpressive/regex_compiler.hpp:284: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:212: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:120: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:139: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(const typename boost::iterator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
xpressive_simple.cc:13: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp:88: warning: comparison between 'enum boost::xpressive::detail::alternates_vector<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/numeric/conversion/detail/meta.hpp: In instantiation of 'boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >':
/usr/local/include/boost/mpl/if.hpp:67: instantiated from 'boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >, boost::mpl::identity<boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >, boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned> >, boost::mpl::identity<boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int> >, boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed> >, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> > > >'
/usr/local/include/boost/mpl/eval_if.hpp:37: instantiated from 'boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >, boost::mpl::identity<boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >, boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned> >, boost::mpl::identity<boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int> >, boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed> >, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> > > >'
/usr/local/include/boost/numeric/conversion/detail/meta.hpp:82: instantiated from 'boost::numeric::convdetail::ct_switch4<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int>, boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int>, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >'
/usr/local/include/boost/numeric/conversion/detail/sign_mixture.hpp:63: instantiated from 'boost::numeric::convdetail::for_sign_mixture<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int>, boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int>, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:164: instantiated from 'boost::numeric::convdetail::get_subranged_Int2Int<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:186: instantiated from 'boost::numeric::convdetail::get_subranged_BuiltIn2BuiltIn<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:208: instantiated from 'boost::numeric::convdetail::get_subranged<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:227: instantiated from 'boost::numeric::convdetail::get_is_subranged<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/conversion_traits.hpp:37: instantiated from 'boost::numeric::convdetail::non_trivial_traits_impl<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/conversion_traits.hpp:23: instantiated from 'boost::numeric::conversion_traits<unsigned char, int>'
/usr/local/include/boost/xpressive/detail/dynamic/parse_charset.hpp:85: instantiated from 'boost::xpressive::detail::escape_value<typename boost::iterator_value<Iterator>::type, typename CompilerTraits::regex_traits::char_class_type> boost::xpressive::detail::parse_escape(FwdIter&, FwdIter, CompilerTraits&) [with FwdIter = const char*, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:726: instantiated from 'boost::xpressive::detail::escape_value<typename boost::iterator_value<Iterator>::type, typename RegexTraits::char_class_type> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_escape(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:522: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_atom(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:589: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_quant(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:622: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_sequence(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:281: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:212: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:120: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
<snipped>
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::basic_chset<char> > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'

我在导致出现这些警告的程序中做了什么?

编辑:我使用的是 boost 版本 1.43 和 g++ 版本 4.2.1。

最佳答案

Boost 1.47 和 g++ 4.4.3 不会对您的代码发出任何警告,即使使用 -Wall 和 -Wextra。最可能的解释是您使用的 boost 版本较旧,并且自该版本发布以来,xpressive 开发人员修复了许多警告。

就是说,如果您(像我们一样)使用极其激进的警告级别进行编译,大量的 boost 仍然会产生很多警告。我们的解决方法是使用 g++ 的“警告抑制” header ,看起来有点像这样:

#ifdef __GNUC__
#pragma GCC system_header
#endif

#include <boost/xpressive/xpressive.hpp>

我们通常将此文件放在名为 nowarnings/boost/xpressive/xpressive.hpp 的目录中,并包含该文件以抑制来自 boost header 的警告。

关于C++ 编译器在使用 boost::xpressive 时给出警告页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7657269/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com