Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10459 closed Bugs (wontfix)

boost::log::v2_mt_nt5::aux::record_pump: function marked as __forceinline not inlined

Reported by: r.korthaus@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

boost/log/sources/record_ostream.hpp(291): warning C4714:

'boost::log::v2_mt_nt5::aux::record_pump': function marked as forceinline not inlined

This is generated with MSVC12 warning level 4. Compiling with treat warnings as error is problematic.

Attached a fix that disables _forceinline for MSVC:

template< typename LoggerT >
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
record_pump< LoggerT > make_record_pump( LoggerT& lg, record& rec )
#else
BOOST_FORCEINLINE record_pump< LoggerT > make_record_pump(LoggerT& lg, record& rec)
#endif
{
    return record_pump< LoggerT >(lg, rec);
}

Change History (2)

comment:1 by Andrey Semashev, 8 years ago

Resolution: wontfix
Status: newclosed

The warning is disabled for the whole library in boost/log/detail/header.hpp. If the compiler still emits the warning then this is probably a compiler issue. I'm not going to add workarounds for such bugs. You can also disable the warning in the command line.

comment:2 by r.korthaus@…, 8 years ago

Disabled this warning successfully for our Visual Studio project now, which is ok as we do not use _forceinline anywhere in our code. Nevertheless attached is a minimal example that triggers the warning in a freshly generated Visual Studio 2013 project (for the record):

#include <stdio.h>
#include <tchar.h>
#include <boost/log/common.hpp>
#include <boost/log/trivial.hpp>

int _tmain(int argc, _TCHAR* argv[])
{
   boost::log::sources::severity_channel_logger_mt< boost::log::trivial::severity_level > logger;
   BOOST_LOG_CHANNEL_SEV( logger, "A Channel Name", boost::log::trivial::fatal ) << "fatal error";
   return 0;
}

The warning is triggered by the use of BOOST_LOG_CHANNEL_SEV:

>...\boost_1_56_0\include\boost/smart_ptr/intrusive_ptr.hpp(182): warning C4714: "boost::log::v2s_mt_nt5::aux::record_pump<boost::log::v2s_mt_nt5::sources::severity_channel_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level,std::string>> boost::log::v2s_mt_nt5::aux::make_record_pump<boost::log::v2s_mt_nt5::sources::severity_channel_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level,std::string>>(LoggerT &,boost::log::v2s_mt_nt5::record &)", function marked as __forceinline not inlined
1>          with
1>          [
1>              LoggerT=boost::log::v2s_mt_nt5::sources::severity_channel_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level,std::string>
1>          ]
1>          ...\boost_1_56_0\include\boost/log/sources/record_ostream.hpp(292): See declaration of 'boost::log::v2s_mt_nt5::aux::make_record_pump'
Note: See TracTickets for help on using tickets.