benchmark
benchmark copied to clipboard
Warnings C4244, C4305, C4722, ... when compiling with MS Visual Studio 2017 15.9.12
googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'benchmark::IterationCount', possible loss of data googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'const benchmark::IterationCount', possible loss of data d:\thirdparty\trunk\googlebenchmark\test\statistics_gtest.cc(25): warning C4305: 'argument': truncation from 'double' to 'RawType' googlebenchmark\test\statistics_gtest.cc(24): warning C4244: 'argument': conversion from 'double' to 'RawType', possible loss of data googlebenchmark\src\benchmark_register.h(25): warning C4244: '=': conversion from 'int' to 'T', possible loss of data googlebenchmark\third_party\googletest\src\googlemock\include\gmock\gmock-matchers.h(156): warning C4244: 'argument': conversion from 'const M' to 'const Element', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'benchmark::IterationCount', possible loss of data googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'const benchmark::IterationCount', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\test\statistics_gtest.cc(25): warning C4305: 'argument': truncation from 'double' to 'RawType' googlebenchmark\test\statistics_gtest.cc(24): warning C4244: 'argument': conversion from 'double' to 'RawType', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\benchmark_register.h(25): warning C4244: '=': conversion from 'int' to 'T', possible loss of data googlebenchmark\third_party\googletest\src\googlemock\include\gmock\gmock-matchers.h(156): warning C4244: 'argument': conversion from 'const M' to 'const Element', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak
Hi
Are you on the latest version? I'm sure we've hammered these out.
Alternatively, how are you building it (cmake should disable the warnings we can't fix)?
Dominic Hamon | Google There are no bad ideas; only good ideas that go horribly wrong.
On Tue, Jun 4, 2019 at 8:41 AM lady mesh [email protected] wrote:
googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'benchmark::IterationCount', possible loss of data googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'const benchmark::IterationCount', possible loss of data d:\thirdparty\trunk\googlebenchmark\test\statistics_gtest.cc(25): warning C4305: 'argument': truncation from 'double' to 'RawType' googlebenchmark\test\statistics_gtest.cc(24): warning C4244: 'argument': conversion from 'double' to 'RawType', possible loss of data googlebenchmark\src\benchmark_register.h(25): warning C4244: '
=': conversion from 'int' to 'T', possible loss of data googlebenchmark\third_party\googletest\src\googlemock\include\gmock\gmock-matchers.h(156): warning C4244: 'argument': conversion from 'const M' to 'const Element', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'benchmark::IterationCount', possible loss of data googlebenchmark\src\benchmark_runner.cc(267): warning C4244: 'initializing': conversion from 'double' to 'const benchmark::IterationCount', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\test\statistics_gtest.cc(25): warning C4305: 'argument': truncation from 'double' to 'RawType' googlebenchmark\test\statistics_gtest.cc(24): warning C4244: 'argument': conversion from 'double' to 'RawType', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\benchmark_register.h(25): warning C4244: '=': conversion from 'int' to 'T', possible loss of data googlebenchmark\third_party\googletest\src\googlemock\include\gmock\gmock-matchers.h(156): warning C4244: 'argument': conversion from 'const M' to 'const Element', possible loss of data googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak googlebenchmark\src\check.h(41): warning C4722: 'benchmark::internal::CheckHandler::~CheckHandler': destructor never returns, potential memory leak
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/benchmark/issues/826?email_source=notifications&email_token=AAD4QMUXSQITNG57EARQCIDPYYMDFA5CNFSM4HSZTXE2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GXOS64A, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD4QMSZM2P2LTB2KR5Y6CDPYYMDFANCNFSM4HSZTXEQ .
Hi, the version I build was v1.5.0. I build with Visual Studio's internal cmake.
Ahah! I think some of these are unexpected side-effects of a change @LebedevRI made to the definition of IterationCount. I'm not sure why our AppVeyor builds didn't catch them.
We should be ignoring 4722 though as that isn't something we consider an error (in the fatal check condition).
Dominic Hamon | Google There are no bad ideas; only good ideas that go horribly wrong.
On Wed, Jun 5, 2019 at 7:18 PM lady mesh [email protected] wrote:
Hi, the version I build was v1.5.0. I build with Visual Studio's internal cmake.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/benchmark/issues/826?email_source=notifications&email_token=AAD4QMQ272I5TLSD7V6SSVDPY77PFA5CNFSM4HSZTXE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXASNHY#issuecomment-499197599, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD4QMRXSWJXVAVHR2VBTNDPY77PFANCNFSM4HSZTXEQ .
I compiled the new benchmark-1.5.4.zip with Visual Studio 2019 Prof. 16.9.6 on Windows 10 20H2 but again get these warnings. The warning is generated because std::abort(); is called in ~CheckHandler() According to https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4722?view=msvc-160 Quote: "The flow of control terminates in a destructor. The thread or the entire program will terminate and allocated resources may not be released. Furthermore, if a destructor will be called for stack unwinding during exception processing, the behavior of executable is undefined. To resolve, remove the function call that causes the destructor to not return." It would be nice if either std::abort(); is removed from the dtor or the warning is disabled.
I'm comfortable removing the warning as this is working as intended, from the check handler pov.