diff options
author | Brad King <brad.king@kitware.com> | 2018-11-26 12:59:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-11-26 13:00:01 (GMT) |
commit | ada104175454f8e393083f116e200344fe846f34 (patch) | |
tree | 8effde8aad95fe5bf8235a8635aed562239223fb /Source | |
parent | af2960e0fdd8be7cd3ab8b2b894e18a0d3056db9 (diff) | |
parent | ce2570b2071360c0b4bb4cd3c62ed8cccab26513 (diff) | |
download | CMake-ada104175454f8e393083f116e200344fe846f34.zip CMake-ada104175454f8e393083f116e200344fe846f34.tar.gz CMake-ada104175454f8e393083f116e200344fe846f34.tar.bz2 |
Merge topic 'clang-tidy-bugprone'
ce2570b207 clang-tidy: Enable checks from bugprone set
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2642
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 4 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1d938e6..2e1bb0a 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -3,6 +3,7 @@ #include "cmCTestTestHandler.h" #include <algorithm> #include <chrono> +#include <cmath> #include <cmsys/Base64.h> #include <cmsys/Directory.hxx> #include <cmsys/RegularExpression.hxx> @@ -544,8 +545,7 @@ int cmCTestTestHandler::ProcessHandler() } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl - << passColorCode << static_cast<int>(percent + .5f) - << "% tests passed" + << passColorCode << std::lround(percent) << "% tests passed" << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) << ", " << failedColorCode << failed.size() << " tests failed" << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3012b0a..fa2a3e1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ #include <algorithm> #include <assert.h> +#include <cmath> #include <ctype.h> #include <memory> // IWYU pragma: keep #include <sstream> @@ -2602,10 +2603,10 @@ public: bool UpdatePercentage(double value, double total, std::string& status) { - int OldPercentage = this->CurrentPercentage; + long OldPercentage = this->CurrentPercentage; if (total > 0.0) { - this->CurrentPercentage = static_cast<int>(value / total * 100.0 + 0.5); + this->CurrentPercentage = std::lround(value / total * 100.0); if (this->CurrentPercentage > 100) { // Avoid extra progress reports for unexpected data beyond total. this->CurrentPercentage = 100; @@ -2627,7 +2628,7 @@ public: cmFileCommand* GetFileCommand() { return this->FileCommand; } private: - int CurrentPercentage; + long CurrentPercentage; cmFileCommand* FileCommand; std::string Text; }; |