Andrey, I just downloaded the latest release of Boost 1.65 and I noticed that I am getting a warning on the log formatter somewhere in the template expansion. My visual studio warning level is set to 4. I have my compilation set to treat warnings as errors, and although I could work around this by making an exception to ignore warnign level 4244, I would prefer to not have to do this (as was the case in version 1.64). Is there some static_cast I can add to work around this - can you tell me what changed. It appears that the TimeDurationT template parameter passed to decompose_time_of_day contains hours, minutes and seconds getters that return uint32_t values instead of uint64_t. I am building a 64 bit app.
3>Logger.cpp
1>cmdline.vcxproj -> C:\main\dlmu\dlf-0339.1\win32\cmdline\x64\Debug\cmdline.lib
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(66): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(109): note: see reference to function template instantiation 'void boost::log::v2s_mt_nt6::expressions::aux::date_time_support::decompose_time_of_day<boost::posix_time::time_duration,boost::posix_time::ptime>(const TimeDurationT &,boost::log::v2s_mt_nt6::aux::decomposed_time_wrapper<boost::posix_time::ptime> &)' being compiled
3> with
3> [
3> TimeDurationT=boost::posix_time::time_duration
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(166): note: see reference to function template instantiation 'void boost::log::v2s_mt_nt6::expressions::aux::date_time_support::decompose_time<boost::posix_time::ptime,boost::posix_time::ptime>(const TimeT &,boost::log::v2s_mt_nt6::aux::decomposed_time_wrapper<boost::posix_time::ptime> &)' being compiled
3> with
3> [
3> TimeT=boost::posix_time::ptime
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(156): note: while compiling class template member function 'void boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>::formatter::operator ()(boost::log::v2s_mt_nt6::basic_formatting_ostream<CharT,std::char_traits<char>,std::allocator<char>> &,const boost::posix_time::ptime &) const'
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\detail\light_function.hpp(362): note: see reference to function template instantiation 'void boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>::formatter::operator ()(boost::log::v2s_mt_nt6::basic_formatting_ostream<CharT,std::char_traits<char>,std::allocator<char>> &,const boost::posix_time::ptime &) const' being compiled
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(175): note: see reference to class template instantiation 'boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>::formatter' being compiled
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(174): note: while compiling class template member function 'boost::log::v2s_mt_nt6::aux::light_function<void (boost::log::v2s_mt_nt6::basic_formatting_ostream<char,std::char_traits<char>,std::allocator<char>> &,const boost::posix_time::ptime &)> boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>::parse(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)'
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\expressions\formatters\date_time.hpp(96): note: see reference to function template instantiation 'boost::log::v2s_mt_nt6::aux::light_function<void (boost::log::v2s_mt_nt6::basic_formatting_ostream<char,std::char_traits<char>,std::allocator<char>> &,const boost::posix_time::ptime &)> boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>::parse(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)' being compiled
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(185): note: see reference to class template instantiation 'boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits_impl<boost::posix_time::ptime,CharT>' being compiled
3> with
3> [
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\expressions\formatters\date_time.hpp(96): note: see reference to class template instantiation 'boost::log::v2s_mt_nt6::expressions::aux::date_time_formatter_generator_traits<boost::posix_time::ptime,char,void>' being compiled
3>c:\main\extlibs\boost_1_65_0\boost\log\expressions\formatters\date_time.hpp(95): note: while compiling class template member function 'boost::log::v2s_mt_nt6::expressions::format_date_time_terminal<T,FallbackPolicyT,CharT>::format_date_time_terminal(const boost::log::v2s_mt_nt6::attribute_name &,const boost::log::v2s_mt_nt6::fallback_to_none &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)'
3> with
3> [
3> T=boost::posix_time::ptime,
3> FallbackPolicyT=boost::log::v2s_mt_nt6::fallback_to_none,
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\expressions\formatters\date_time.hpp(231): note: see reference to function template instantiation 'boost::log::v2s_mt_nt6::expressions::format_date_time_terminal<T,FallbackPolicyT,CharT>::format_date_time_terminal(const boost::log::v2s_mt_nt6::attribute_name &,const boost::log::v2s_mt_nt6::fallback_to_none &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)' being compiled
3> with
3> [
3> T=boost::posix_time::ptime,
3> FallbackPolicyT=boost::log::v2s_mt_nt6::fallback_to_none,
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\mpl\aux_\preprocessed\plain\or.hpp(51): note: see reference to class template instantiation 'boost::log::v2s_mt_nt6::expressions::format_date_time_terminal<T,FallbackPolicyT,CharT>' being compiled
3> with
3> [
3> T=boost::posix_time::ptime,
3> FallbackPolicyT=boost::log::v2s_mt_nt6::fallback_to_none,
3> CharT=char
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\phoenix\core\actor.hpp(199): note: see reference to class template instantiation 'boost::mpl::or_<boost::phoenix::is_custom_terminal<Expr,void>,boost::mpl::bool_<false>,boost::mpl::false_,boost::mpl::false_,boost::mpl::false_>' being compiled
3> with
3> [
3> Expr=boost::log::v2s_mt_nt6::expressions::format_date_time_terminal<boost::posix_time::ptime,boost::log::v2s_mt_nt6::fallback_to_none,char>
3> ]
3>c:\main\extlibs\boost_1_65_0\boost\log\expressions\formatters\date_time.hpp(154): note: see reference to class template instantiation 'boost::phoenix::actor<boost::log::v2s_mt_nt6::expressions::format_date_time_terminal<T,FallbackPolicyT,CharT>>' being compiled
3> with
3> [
3> T=boost::posix_time::ptime,
3> FallbackPolicyT=boost::log::v2s_mt_nt6::fallback_to_none,
3> CharT=char
3> ]
3>c:\main\dlmu\dlf-0339.1\src\util\logger.cpp(118): note: see reference to class template instantiation 'boost::log::v2s_mt_nt6::expressions::format_date_time_actor<boost::posix_time::ptime,boost::log::v2s_mt_nt6::fallback_to_none,char,boost::phoenix::actor>' being compiled
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(67): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data
3>c:\main\extlibs\boost_1_65_0\boost\log\support\date_time.hpp(68): warning C4244: '=': conversion from '__int64' to 'uint32_t', possible loss of data
3>util.vcxproj -> C:\main\dlmu\dlf-0339.1\win32\util\x64\Debug\util.lib
3>Done building project "util.vcxproj".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there some static_cast I can add to work around this - can you tell me what changed.
There was no change in Boost.Log but there might have been a change in Boost.DateTime or some other code or the compiler. Anyway, you will have to either disable the warning or add static_casts to uint32_t in boost/log/support/date_time.hpp in the various decompose_ functions, where there is assignment to decomposed_time_wrapper members.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Andrey, I just downloaded the latest release of Boost 1.65 and I noticed that I am getting a warning on the log formatter somewhere in the template expansion. My visual studio warning level is set to 4. I have my compilation set to treat warnings as errors, and although I could work around this by making an exception to ignore warnign level 4244, I would prefer to not have to do this (as was the case in version 1.64). Is there some static_cast I can add to work around this - can you tell me what changed. It appears that the TimeDurationT template parameter passed to decompose_time_of_day contains hours, minutes and seconds getters that return uint32_t values instead of uint64_t. I am building a 64 bit app.
Thanks in advance
John
The way I call the logger is as follows:
The error details are as follows:
There was no change in Boost.Log but there might have been a change in Boost.DateTime or some other code or the compiler. Anyway, you will have to either disable the warning or add
static_cast
s touint32_t
inboost/log/support/date_time.hpp
in the variousdecompose_
functions, where there is assignment todecomposed_time_wrapper
members.