[Cmake-commits] CMake branch, master, updated. v3.12.3-789-g0b1b842

Kitware Robot kwrobot at kitware.com
Wed Oct 3 11:45:04 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  0b1b842e9348f554017a29f8f1bca9268e7a2a46 (commit)
       via  6d288846178a1b75e9d50578d710265516ce8f82 (commit)
      from  583060a9690d8339ecd209f8bf7d087ab4477532 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b1b842e9348f554017a29f8f1bca9268e7a2a46
commit 0b1b842e9348f554017a29f8f1bca9268e7a2a46
Merge: 583060a 6d28884
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 3 15:38:40 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Oct 3 11:38:46 2018 -0400

    Merge topic 'ctest-num-width'
    
    6d28884617 cmCTestRunTest: Avoid float/int conversions in number width logic
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2433


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d288846178a1b75e9d50578d710265516ce8f82
commit 6d288846178a1b75e9d50578d710265516ce8f82
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 2 15:09:12 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 2 15:40:29 2018 -0400

    cmCTestRunTest: Avoid float/int conversions in number width logic
    
    Use of `std::log10` added by commit 02c5091c90 (cmCTestRunTest: Simplify
    number width computation, 2018-09-08) broke our number width computation
    on some platforms where
    
        static_cast<int>(std::log10(static_cast<size_t>(10)))
    
    somehow produces `0` instead of `1`.  Re-implement the logic to avoid
    floating-point computations.

diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 48a5064..10dceca 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -5,7 +5,6 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
-#include <cmath>
 #include <set>
 #include <stddef.h>
 #include <string>
@@ -122,7 +121,12 @@ private:
 
 inline int getNumWidth(size_t n)
 {
-  return static_cast<int>(std::log10(n)) + 1;
+  int w = 1;
+  while (n >= 10) {
+    n /= 10;
+    ++w;
+  }
+  return w;
 }
 
 #endif

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestRunTest.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list