увеличить отчет о 1,73 сообщения во время сборки проекта - PullRequest
0 голосов
/ 04 августа 2020

Я использую Boost 1.73 в старом проекте, который использовал Boost 1.48. Я намерен исправить все предупреждения и ошибки в процессе.

При компиляции проекта я получаю некоторые странные сообщения, которые находятся не в источнике проекта, а в самом ускорении, эти сообщения похожи на большинство ошибок сообщения, crypti c и не очень полезны.

1>debugengine.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\utility(173): warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
1>        with
1>        [
1>            _Ty=int
1>        ]
1>        and
1>        [
1>            _Ty2=unsigned short
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(111): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=unsigned short,
1>            _Other1=const char (&)[4],
1>            _Other2=int
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(99): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=unsigned short,
1>            _Other1=const char (&)[4],
1>            _Other2=int
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(168): note: see reference to function template instantiation 'unsigned short boost::date_time::month_str_to_ushort<month_type>(const std::string &)' being compiled
1>c:\boost\boost_1_73_0\boost\date_time\gregorian\parsers.hpp(49): note: see reference to function template instantiation 'date_type boost::date_time::parse_date<boost::gregorian::date>(const std::string &,int)' being compiled
1>        with
1>        [
1>            date_type=boost::gregorian::date
1>        ]
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled

Что я могу сделать?

Я использую MSV C 2017.

I Я сузил проблему до одного файла и закомментировал все, кроме:

#include <boost/date_time.hpp>

Вот что я получаю при компиляции только этого:

1>------ Build started: Project: Debug Service Group, Configuration: Debug Win32 ------
1>debugengine.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\utility(173): warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
1>        with
1>        [
1>            _Ty=int
1>        ]
1>        and
1>        [
1>            _Ty2=unsigned short
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(111): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=unsigned short,
1>            _Other1=const char (&)[4],
1>            _Other2=int
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(99): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=unsigned short,
1>            _Other1=const char (&)[4],
1>            _Other2=int
1>        ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(168): note: see reference to function template instantiation 'unsigned short boost::date_time::month_str_to_ushort<month_type>(const std::string &)' being compiled
1>c:\boost\boost_1_73_0\boost\date_time\gregorian\parsers.hpp(49): note: see reference to function template instantiation 'date_type boost::date_time::parse_date<boost::gregorian::date>(const std::string &,int)' being compiled
1>        with
1>        [
1>            date_type=boost::gregorian::date
1>        ]
1>Done building project "Debug Service Group.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

1 Ответ

0 голосов
/ 04 августа 2020

Предупреждения безвредны. Вот источник в строке boost \ date_time \ date_parsing.hpp 99

    static std::map<std::string, unsigned short> month_map =
      { { "jan", 1 },  { "january", 1 },

Как вы можете видеть, тип значения карты unsigned short, но он инициализируется значениями int.

Меня немного удивило предупреждение, вы могли подумать, что MSV C 2017 будет достаточно умен, чтобы понять, что присвоение 1 unsigned short не является проблемой.

Я не не получаю никаких предупреждений с MSV C 2019

...