[xpressive][proto] Generates VS2010 C4714 in 1.49 but not in 1.48

The following code produces a C4714 warning in Visual Studio 2010 with Boost 1.49 but not 1.48: ------------------------------------------------------------------------ ---------------------------------------- #include "stdafx.h" #include <boost/xpressive/xpressive.hpp> void main() { using namespace boost::xpressive; sregex pat1 = "foo" >> +space >> "bar"; // OK in 1.48, C4714 in 1.49 sregex pat2 = "foo" >> +space >> "bar" >> +space; // OK in 1.48, C4714 in 1.49 sregex pat3 = "foo" >> +space; // OK in 1.48, OK in 1.49 sregex pat4 = "foo" >> +space >> +digit; // OK in 1.48, OK in 1.49 sregex pat5 = +space >> "foo" >> +space; // OK in 1.48, C4714 in 1.49 } ------------------------------------------------------------------------ ---------------------------------------- System: Compiler: Visual Studio 2010 SP1 [Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86] Compiler warning level: /W4 OS: Windows 7 Professional 32-bit I would be OK with suppressing the warning, but I haven't been able to do so. Putting "#pragma warning(disable : 4714)" in my source file and in boost/xpressive/detail/core/ sub_match_vector.hpp and in boost/proto/transform/call.hpp does not suppress the warning. Using the "disable specific warnings" compiler switch /wd4714 also does not work. Complete warning text: ------------------------------------------------------------------------ ---------------------------------------- 1>c:\Boost\include\boost-1_49\boost/xpressive/detail/core/sub_match_vect or.hpp(115): warning C4714: function 'boost::xpressive::detail::static_xpression<Matcher,Next> boost::proto::call<PrimitiveTransform>::impl2<Expr,State,Data,B>::operat or ()(const boost::proto::exprns_::expr<Tag,Args,Arity> &,const boost::xpressive::detail::static_xpression<boost::xpressive::detail::str ing_matcher<Traits,ICase>,boost::xpressive::detail::static_xpression<Mat cher,boost::xpressive::detail::static_xpression<boost::xpressive::detail ::end_matcher,boost::xpressive::detail::no_next>>> &,boost::xpressive::detail::xpression_visitor<BidiIter,ICase,Traits> &) const' marked as __forceinline not inlined 1> with 1> [ 1> Matcher=boost::xpressive::detail::simple_repeat_matcher<boost::xpressive ::detail::static_xpression<boost::xpressive::detail::posix_charset_match er<traits_type>,boost::xpressive::detail::true_xpression>,boost::mpl::tr ue_>, 1> Next=boost::xpressive::detail::static_xpression<boost::xpressive::detail ::string_matcher<traits_type,boost::mpl::false_>,boost::xpressive::detai l::static_xpression<boost::xpressive::detail::simple_repeat_matcher<boos t::xpressive::detail::static_xpression<boost::xpressive::detail::posix_c harset_matcher<traits_type>,boost::xpressive::detail::true_xpression>,bo ost::mpl::true_>,boost::xpressive::detail::static_xpression<boost::xpres sive::detail::end_matcher,boost::xpressive::detail::no_next>>>, 1> PrimitiveTransform=boost::xpressive::Grammar<char> (boost::xpressive::grammar_detail::as_repeat<char,boost::xpressive::Gram mar<char>,boost::mpl::true_>), 1> Expr=const boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus,boost: :proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::p roto::argsns_::term<boost::xpressive::detail::posix_charset_placeholder> ,0> &>,1> &, 1> State=boost::xpressive::detail::static_xpression<boost::xpressive::detai l::string_matcher<traits_type,boost::mpl::false_>,boost::xpressive::deta il::static_xpression<boost::xpressive::detail::simple_repeat_matcher<boo st::xpressive::detail::static_xpression<boost::xpressive::detail::posix_ charset_matcher<traits_type>,boost::xpressive::detail::true_xpression>,b oost::mpl::true_>,boost::xpressive::detail::static_xpression<boost::xpre ssive::detail::end_matcher,boost::xpressive::detail::no_next>>>, 1> Data=boost::xpressive::detail::xpression_visitor<std::_String_const_iter ator<char,std::char_traits<char>,std::allocator<char>>,boost::mpl::false _,traits_type> , 1> B=true, 1> Tag=boost::proto::tagns_::tag::unary_plus, 1> Args=boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::p roto::argsns_::term<boost::xpressive::detail::posix_charset_placeholder> ,0> &>, 1> Arity=1, 1> Traits=traits_type, 1> ICase=boost::mpl::false_, 1> BidiIter=std::_String_const_iterator<char,std::char_traits<char>,std::al locator<char>> 1> ] 1> c:\Boost\include\boost-1_49\boost/proto/transform/call.hpp(168) : see declaration of 'boost::proto::call<PrimitiveTransform>::impl2<Expr,State,Data,B>::opera tor ()' 1> with 1> [ 1> PrimitiveTransform=boost::xpressive::Grammar<char> (boost::xpressive::grammar_detail::as_repeat<char,boost::xpressive::Gram mar<char>,boost::mpl::true_>), 1> Expr=const boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus,boost: :proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::p roto::argsns_::term<boost::xpressive::detail::posix_charset_placeholder> ,0> &>,1> &, 1> State=boost::xpressive::detail::static_xpression<boost::xpressive::detai l::string_matcher<traits_type,boost::mpl::false_>,boost::xpressive::deta il::static_xpression<boost::xpressive::detail::simple_repeat_matcher<boo st::xpressive::detail::static_xpression<boost::xpressive::detail::posix_ charset_matcher<traits_type>,boost::xpressive::detail::true_xpression>,b oost::mpl::true_>,boost::xpressive::detail::static_xpression<boost::xpre ssive::detail::end_matcher,boost::xpressive::detail::no_next>>>, 1> Data=boost::xpressive::detail::xpression_visitor<std::_String_const_iter ator<char,std::char_traits<char>,std::allocator<char>>,boost::mpl::false _,traits_type> , 1> B=true 1> ] ------------------------------------------------------------------------ ---------------------------------------- Thanks in advance for any assistance. Brian Lawry blawry@cccglobal.com Compressor Controls Corp Manufacturing Software Engineer /"\ ASCII Ribbon Campaign \ / no HTML in email & vCards X no proprietary attachments / \ use open standards

On 4/24/2012 2:48 PM, Lawry, Brian wrote:
The following code produces a C4714 warning in Visual Studio 2010 with Boost 1.49 but not 1.48: <snip>
The __forceinline was added in 1.49 at the request of some users, and it has a measurable performance impact, so I'm inclined to keep it.
I would be OK with suppressing the warning, but I haven't been able to do so. Putting "#pragma warning(disable : 4714)" in my source file and in boost/xpressive/detail/core/ sub_match_vector.hpp and in boost/proto/transform/call.hpp does not suppress the warning. Using the "disable specific warnings" compiler switch /wd4714 also does not work.
That's super-annoying. Have you filed a compiler bug? The MSVC team isn't very responsive about fixing their bugs, but it has been known to happen from time to time. As a work-around, you can try compiling with /DBOOST_FORCEINLINE=inline. The warning should go away, but your code might run marginally slower. HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com

On 4/24/2012 11:33 PM, Eric Niebler wrote: => On 4/24/2012 2:48 PM, Lawry, Brian wrote:
I would be OK with suppressing the warning, but I haven't been able to do so. Putting "#pragma warning(disable : 4714)" in my source file and in boost/xpressive/detail/core/ sub_match_vector.hpp and in boost/proto/transform/call.hpp does not suppress the warning. Using the "disable specific warnings" compiler switch /wd4714 also does not work.
I checked this and found that the warning can in fact be suppressed. I went through proto's source files and suppressed it everywhere __forceinline is used. Your sample code now compiles cleanly with /W4 with boost trunk. Thanks for the report. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Lawry, Brian