diff --git a/CMakeLists.txt b/CMakeLists.txt index c7fe7a8e..8ddacabb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,12 @@ else() # Disable warnings regarding deprecated parts of the library while building # and testing those parts of the library. add_cxx_compiler_flag(-Wno-deprecated-declarations) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # Intel silently ignores '-Wno-deprecated-declarations', + # warning no. 1786 must be explicitly disabled. + # See #631 for rationale. + add_cxx_compiler_flag(-wd1786) + endif() # Disable deprecation warnings for release builds (when -Werror is enabled). add_cxx_compiler_flag(-Wno-deprecated RELEASE) add_cxx_compiler_flag(-Wno-deprecated RELWITHDEBINFO) diff --git a/src/complexity.cc b/src/complexity.cc index 02fe3feb..aafd538d 100644 --- a/src/complexity.cc +++ b/src/complexity.cc @@ -36,10 +36,10 @@ BigOFunc* FittingCurve(BigO complexity) { return [](int64_t n) -> double { return std::pow(n, 3); }; case oLogN: /* Note: can't use log2 because Android's GNU STL lacks it */ - return [](int64_t n) { return kLog2E * log(n); }; + return [](int64_t n) { return kLog2E * log(static_cast(n)); }; case oNLogN: /* Note: can't use log2 because Android's GNU STL lacks it */ - return [](int64_t n) { return kLog2E * n * log(n); }; + return [](int64_t n) { return kLog2E * n * log(static_cast(n)); }; case o1: default: return [](int64_t) { return 1.0; }; diff --git a/test/complexity_test.cc b/test/complexity_test.cc index c732e6ed..5f916608 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -85,7 +85,7 @@ std::vector ConstructRandomVector(int64_t size) { std::vector v; v.reserve(static_cast(size)); for (int i = 0; i < size; ++i) { - v.push_back(std::rand() % size); + v.push_back(static_cast(std::rand() % size)); } return v; } @@ -106,7 +106,7 @@ BENCHMARK(BM_Complexity_O_N) BENCHMARK(BM_Complexity_O_N) ->RangeMultiplier(2) ->Range(1 << 10, 1 << 16) - ->Complexity([](int64_t n) -> double { return n; }); + ->Complexity([](int64_t n) -> double { return static_cast(n); }); BENCHMARK(BM_Complexity_O_N) ->RangeMultiplier(2) ->Range(1 << 10, 1 << 16) @@ -142,7 +142,7 @@ BENCHMARK(BM_Complexity_O_N_log_N) BENCHMARK(BM_Complexity_O_N_log_N) ->RangeMultiplier(2) ->Range(1 << 10, 1 << 16) - ->Complexity([](int64_t n) { return kLog2E * n * log(n); }); + ->Complexity([](int64_t n) { return kLog2E * n * log(static_cast(n)); }); BENCHMARK(BM_Complexity_O_N_log_N) ->RangeMultiplier(2) ->Range(1 << 10, 1 << 16)