ソースを参照

Merge topic 'ci-fedora-36'

ef6a7921e5 gitlab-ci: use Fedora 36 images and environments
483ff3b903 ci: update Linux image to Fedora 36
13c5153ccd ci: make rvm version comments consistent
6c08dd972c clang-tidy: suppress `google-readability-casting` lint
17b7bbf2a0 clang-tidy: suppress new `readability-identifier-length` lint
16e6e4e7dd cmFileCommand: remove an unnecessary cast
b89c085237 clang-tidy: fix `readability-static-definition-in-anonymous-namespace` lints
c8c9d7de03 clang-tidy: fix `bugprone-exception-escape` lints
...

Acked-by: Kitware Robot <[email protected]>
Merge-request: !7271
Brad King 3 年 前
コミット
9eb81b2f9a
100 ファイル変更322 行追加380 行削除
  1. 1 1
      .clang-tidy
  2. 28 28
      .gitlab-ci.yml
  3. 0 1
      .gitlab/ci/configure_fedora35_clang_analyzer.cmake
  4. 0 3
      .gitlab/ci/configure_fedora35_tidy.cmake
  5. 1 1
      .gitlab/ci/configure_fedora36_asan.cmake
  6. 1 0
      .gitlab/ci/configure_fedora36_clang_analyzer.cmake
  7. 0 0
      .gitlab/ci/configure_fedora36_common.cmake
  8. 0 0
      .gitlab/ci/configure_fedora36_makefiles.cmake
  9. 1 1
      .gitlab/ci/configure_fedora36_ninja.cmake
  10. 0 0
      .gitlab/ci/configure_fedora36_ninja_multi.cmake
  11. 0 0
      .gitlab/ci/configure_fedora36_sphinx.cmake
  12. 0 0
      .gitlab/ci/configure_fedora36_sphinx_package.cmake
  13. 3 0
      .gitlab/ci/configure_fedora36_tidy.cmake
  14. 0 0
      .gitlab/ci/ctest_memcheck_fedora36_asan.lsan.supp
  15. 1 0
      .gitlab/ci/docker/debian10/install_rvm.sh
  16. 2 2
      .gitlab/ci/docker/fedora36/Dockerfile
  17. 0 0
      .gitlab/ci/docker/fedora36/install_deps.sh
  18. 0 0
      .gitlab/ci/docker/fedora36/install_ispc.sh
  19. 2 4
      .gitlab/ci/docker/fedora36/install_rvm.sh
  20. 0 2
      .gitlab/ci/env_fedora35_makefiles.cmake
  21. 0 0
      .gitlab/ci/env_fedora36_asan.sh
  22. 0 0
      .gitlab/ci/env_fedora36_clang_analyzer.sh
  23. 2 0
      .gitlab/ci/env_fedora36_makefiles.cmake
  24. 29 29
      .gitlab/os-linux.yml
  25. 2 2
      .gitlab/upload.yml
  26. 1 0
      CTestCustom.cmake.in
  27. 1 1
      Source/CPack/IFW/cmCPackIFWGenerator.cxx
  28. 1 2
      Source/CPack/IFW/cmCPackIFWRepository.cxx
  29. 1 1
      Source/CPack/cmCPackDebGenerator.cxx
  30. 8 9
      Source/CTest/cmCTestBZR.cxx
  31. 3 3
      Source/CTest/cmCTestBinPacker.cxx
  32. 3 4
      Source/CTest/cmCTestCVS.cxx
  33. 1 1
      Source/CTest/cmCTestCoverageHandler.cxx
  34. 6 7
      Source/CTest/cmCTestGIT.cxx
  35. 5 5
      Source/CTest/cmCTestHG.cxx
  36. 2 1
      Source/CTest/cmCTestMemCheckHandler.cxx
  37. 11 12
      Source/CTest/cmCTestP4.cxx
  38. 6 6
      Source/CTest/cmCTestSVN.cxx
  39. 9 10
      Source/CTest/cmCTestSubmitHandler.cxx
  40. 2 1
      Source/CTest/cmCTestTestHandler.cxx
  41. 1 1
      Source/CTest/cmCTestVC.cxx
  42. 2 2
      Source/CursesDialog/cmCursesMainForm.cxx
  43. 3 4
      Source/QtDialog/QCMakeCacheView.cxx
  44. 0 1
      Source/cmArchiveWrite.cxx
  45. 1 1
      Source/cmArchiveWrite.h
  46. 20 17
      Source/cmCTest.cxx
  47. 26 17
      Source/cmConditionEvaluator.cxx
  48. 5 9
      Source/cmCoreTryCompile.cxx
  49. 4 4
      Source/cmCryptoHash.cxx
  50. 1 1
      Source/cmDependsFortran.cxx
  51. 1 2
      Source/cmELF.cxx
  52. 1 1
      Source/cmExtraEclipseCDT4Generator.cxx
  53. 1 1
      Source/cmFileAPI.cxx
  54. 2 2
      Source/cmFileCommand.cxx
  55. 0 10
      Source/cmFileCopier.cxx
  56. 12 11
      Source/cmFileCopier.h
  57. 1 8
      Source/cmFileInstaller.cxx
  58. 7 7
      Source/cmFileInstaller.h
  59. 2 2
      Source/cmForEachCommand.cxx
  60. 1 2
      Source/cmFortranParser.h
  61. 2 1
      Source/cmGeneratedFileStream.cxx
  62. 0 5
      Source/cmGeneratorExpression.cxx
  63. 5 5
      Source/cmGeneratorExpression.h
  64. 0 4
      Source/cmGeneratorExpressionContext.cxx
  65. 4 4
      Source/cmGeneratorExpressionContext.h
  66. 5 5
      Source/cmGeneratorExpressionNode.cxx
  67. 0 1
      Source/cmGeneratorExpressionParser.cxx
  68. 1 1
      Source/cmGeneratorExpressionParser.h
  69. 2 17
      Source/cmGeneratorTarget.cxx
  70. 14 14
      Source/cmGeneratorTarget.h
  71. 1 1
      Source/cmGetPropertyCommand.cxx
  72. 4 1
      Source/cmGlobalGenerator.cxx
  73. 0 12
      Source/cmGraphVizWriter.cxx
  74. 12 12
      Source/cmGraphVizWriter.h
  75. 0 1
      Source/cmInstallDirectoryGenerator.cxx
  76. 1 1
      Source/cmInstallDirectoryGenerator.h
  77. 0 1
      Source/cmInstallExportGenerator.cxx
  78. 1 1
      Source/cmInstallExportGenerator.h
  79. 0 1
      Source/cmInstallFilesGenerator.cxx
  80. 1 1
      Source/cmInstallFilesGenerator.h
  81. 0 1
      Source/cmInstallScriptGenerator.cxx
  82. 1 1
      Source/cmInstallScriptGenerator.h
  83. 0 1
      Source/cmInstallTargetGenerator.cxx
  84. 1 1
      Source/cmInstallTargetGenerator.h
  85. 0 4
      Source/cmLinkLineComputer.cxx
  86. 4 4
      Source/cmLinkLineComputer.h
  87. 10 9
      Source/cmListCommand.cxx
  88. 1 2
      Source/cmListFileCache.cxx
  89. 9 3
      Source/cmListFileCache.h
  90. 1 1
      Source/cmLoadCacheCommand.cxx
  91. 5 11
      Source/cmMakefile.cxx
  92. 2 2
      Source/cmMakefile.h
  93. 3 1
      Source/cmMakefileLibraryTargetGenerator.cxx
  94. 2 2
      Source/cmMakefileProfilingData.cxx
  95. 2 2
      Source/cmMathCommand.cxx
  96. 0 1
      Source/cmOSXBundleGenerator.cxx
  97. 1 1
      Source/cmOSXBundleGenerator.h
  98. 0 1
      Source/cmOutputConverter.cxx
  99. 1 1
      Source/cmOutputConverter.h
  100. 2 2
      Source/cmPolicies.cxx

+ 1 - 1
.clang-tidy

@@ -7,7 +7,6 @@ bugprone-*,\
 -bugprone-misplaced-widening-cast,\
 -bugprone-narrowing-conversions,\
 -bugprone-too-small-loop-variable,\
-google-readability-casting,\
 misc-*,\
 -misc-no-recursion,\
 -misc-non-private-member-variables-in-classes,\
@@ -24,6 +23,7 @@ readability-*,\
 -readability-convert-member-functions-to-static,\
 -readability-function-cognitive-complexity,\
 -readability-function-size,\
+-readability-identifier-length,\
 -readability-identifier-naming,\
 -readability-implicit-bool-conversion,\
 -readability-inconsistent-declaration-parameter-name,\

+ 28 - 28
.gitlab-ci.yml

@@ -55,7 +55,7 @@ p:source-package:
 
 p:doc-package:
     extends:
-        - .fedora35_sphinx_package
+        - .fedora36_sphinx_package
         - .cmake_prep_doc_linux
         - .linux_builder_tags_qt
         - .cmake_doc_artifacts
@@ -103,16 +103,16 @@ l:iwyu-debian10:
         - .linux_builder_tags
         - .run_automatically
 
-l:tidy-fedora35:
+l:tidy-fedora36:
     extends:
-        - .fedora35_tidy
+        - .fedora36_tidy
         - .cmake_build_linux
         - .linux_builder_tags_qt
         - .run_automatically
 
-l:sphinx-fedora35:
+l:sphinx-fedora36:
     extends:
-        - .fedora35_sphinx
+        - .fedora36_sphinx
         - .cmake_build_linux
         - .linux_builder_tags_qt
         - .run_automatically
@@ -120,9 +120,9 @@ l:sphinx-fedora35:
         CMAKE_CI_JOB_CONTINUOUS: "true"
         CMAKE_CI_JOB_HELP: "true"
 
-l:clang-analyzer-fedora35:
+l:clang-analyzer-fedora36:
     extends:
-        - .fedora35_clang_analyzer
+        - .fedora36_clang_analyzer
         - .cmake_build_linux
         - .linux_builder_tags_qt
         - .run_automatically
@@ -191,17 +191,17 @@ t:debian10-makefiles-clang:
     variables:
         CMAKE_CI_JOB_NIGHTLY: "true"
 
-t:fedora35-makefiles:
+t:fedora36-makefiles:
     extends:
-        - .fedora35_makefiles
+        - .fedora36_makefiles
         - .cmake_test_linux_release
         - .linux_builder_tags_qt
         - .run_dependent
         - .needs_centos6_x86_64
 
-t:fedora35-makefiles-nospace:
+t:fedora36-makefiles-nospace:
     extends:
-        - .fedora35_makefiles
+        - .fedora36_makefiles
         - .cmake_test_linux_release
         - .linux_builder_tags_qt
         - .cmake_junit_artifacts
@@ -209,7 +209,7 @@ t:fedora35-makefiles-nospace:
         - .needs_centos6_x86_64
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake-ci"
-        CMAKE_CI_BUILD_NAME: fedora35_makefiles_nospace
+        CMAKE_CI_BUILD_NAME: fedora36_makefiles_nospace
         CMAKE_CI_JOB_NIGHTLY: "true"
 
 t:cuda9.2-nvidia:
@@ -270,9 +270,9 @@ t:hip4.2-radeon:
     variables:
         CMAKE_CI_NO_MR: "true"
 
-b:fedora35-ninja:
+b:fedora36-ninja:
     extends:
-        - .fedora35_ninja
+        - .fedora36_ninja
         - .cmake_build_linux
         - .cmake_build_artifacts
         - .linux_builder_tags_qt
@@ -289,31 +289,31 @@ b:debian10-makefiles-inplace:
     variables:
         CMAKE_CI_JOB_NIGHTLY: "true"
 
-t:fedora35-ninja:
+t:fedora36-ninja:
     extends:
-        - .fedora35_ninja
+        - .fedora36_ninja
         - .cmake_test_linux
         - .linux_builder_tags_x11
         - .cmake_test_artifacts
         - .run_dependent
     dependencies:
-        - b:fedora35-ninja
+        - b:fedora36-ninja
     needs:
-        - b:fedora35-ninja
+        - b:fedora36-ninja
     variables:
         CMAKE_CI_JOB_CONTINUOUS: "true"
 
-t:fedora35-ninja-multi:
+t:fedora36-ninja-multi:
     extends:
-        - .fedora35_ninja_multi
+        - .fedora36_ninja_multi
         - .cmake_test_linux_external
         - .linux_builder_tags_qt
         - .cmake_junit_artifacts
         - .run_dependent
     dependencies:
-        - t:fedora35-ninja
+        - t:fedora36-ninja
     needs:
-        - t:fedora35-ninja
+        - t:fedora36-ninja
 
 t:intel2016-makefiles:
     extends:
@@ -634,9 +634,9 @@ u:linux-aarch64-package:
 
 ## Sanitizer builds
 
-b:fedora35-asan:
+b:fedora36-asan:
     extends:
-        - .fedora35_asan
+        - .fedora36_asan
         - .cmake_build_linux
         - .cmake_build_artifacts
         - .linux_builder_tags_qt
@@ -644,16 +644,16 @@ b:fedora35-asan:
     variables:
         CMAKE_CI_JOB_NIGHTLY: "true"
 
-t:fedora35-asan:
+t:fedora36-asan:
     extends:
-        - .fedora35_asan
+        - .fedora36_asan
         - .cmake_memcheck_linux
         - .linux_builder_tags_qt
         - .run_dependent
     dependencies:
-        - b:fedora35-asan
+        - b:fedora36-asan
     needs:
-        - b:fedora35-asan
+        - b:fedora36-asan
     variables:
         CMAKE_CI_JOB_NIGHTLY: "true"
 

+ 0 - 1
.gitlab/ci/configure_fedora35_clang_analyzer.cmake

@@ -1 +0,0 @@
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")

+ 0 - 3
.gitlab/ci/configure_fedora35_tidy.cmake

@@ -1,3 +0,0 @@
-set(CMake_RUN_CLANG_TIDY ON CACHE BOOL "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")

+ 1 - 1
.gitlab/ci/configure_fedora35_asan.cmake → .gitlab/ci/configure_fedora36_asan.cmake

@@ -1,4 +1,4 @@
 set(CMAKE_C_FLAGS "-fsanitize=address" CACHE STRING "")
 set(CMAKE_CXX_FLAGS "-fsanitize=address" CACHE STRING "")
 
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora36_common.cmake")

+ 1 - 0
.gitlab/ci/configure_fedora36_clang_analyzer.cmake

@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora36_common.cmake")

+ 0 - 0
.gitlab/ci/configure_fedora35_common.cmake → .gitlab/ci/configure_fedora36_common.cmake


+ 0 - 0
.gitlab/ci/configure_fedora35_makefiles.cmake → .gitlab/ci/configure_fedora36_makefiles.cmake


+ 1 - 1
.gitlab/ci/configure_fedora35_ninja.cmake → .gitlab/ci/configure_fedora36_ninja.cmake

@@ -8,4 +8,4 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
 # Cover compilation with C++11 only and not higher standards.
 set(CMAKE_CXX_STANDARD "11" CACHE STRING "")
 
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora36_common.cmake")

+ 0 - 0
.gitlab/ci/configure_fedora35_ninja_multi.cmake → .gitlab/ci/configure_fedora36_ninja_multi.cmake


+ 0 - 0
.gitlab/ci/configure_fedora35_sphinx.cmake → .gitlab/ci/configure_fedora36_sphinx.cmake


+ 0 - 0
.gitlab/ci/configure_fedora35_sphinx_package.cmake → .gitlab/ci/configure_fedora36_sphinx_package.cmake


+ 3 - 0
.gitlab/ci/configure_fedora36_tidy.cmake

@@ -0,0 +1,3 @@
+set(CMake_RUN_CLANG_TIDY ON CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora36_common.cmake")

+ 0 - 0
.gitlab/ci/ctest_memcheck_fedora35_asan.lsan.supp → .gitlab/ci/ctest_memcheck_fedora36_asan.lsan.supp


+ 1 - 0
.gitlab/ci/docker/debian10/install_rvm.sh

@@ -14,6 +14,7 @@ gpg2 --keyserver hkps://keyserver.ubuntu.com \
 
 curl -sSL https://get.rvm.io | bash -s stable
 
+# keep version in sync with `env_debian*_ninja.sh`
 /usr/local/rvm/bin/rvm install ruby-2.7.0
 
 tar -C /usr/local -cf /root/rvm.tar rvm

+ 2 - 2
.gitlab/ci/docker/fedora35/Dockerfile → .gitlab/ci/docker/fedora36/Dockerfile

@@ -1,10 +1,10 @@
-FROM fedora:35 as rvm-build
+FROM fedora:36 as rvm-build
 MAINTAINER Ben Boeckel <[email protected]>
 
 COPY install_rvm.sh /root/install_rvm.sh
 RUN sh /root/install_rvm.sh
 
-FROM fedora:35
+FROM fedora:36
 MAINTAINER Ben Boeckel <[email protected]>
 
 COPY install_deps.sh /root/install_deps.sh

+ 0 - 0
.gitlab/ci/docker/fedora35/install_deps.sh → .gitlab/ci/docker/fedora36/install_deps.sh


+ 0 - 0
.gitlab/ci/docker/fedora35/install_ispc.sh → .gitlab/ci/docker/fedora36/install_ispc.sh


+ 2 - 4
.gitlab/ci/docker/fedora35/install_rvm.sh → .gitlab/ci/docker/fedora36/install_rvm.sh

@@ -13,9 +13,7 @@ dnf install --setopt=install_weak_deps=False -y \
 
 curl -sSL https://get.rvm.io | bash -s stable
 
-# This is intentionally an older version.
-# If updating, the associated `env_fedora*_makefiles.cmake` file needs updated
-# as well.
-/usr/local/rvm/bin/rvm install ruby-2.7.0
+# keep version in sync with `env_fedora*_makefiles.cmake`
+/usr/local/rvm/bin/rvm install ruby-3.0.4
 
 tar -C /usr/local -cf /root/rvm.tar rvm

+ 0 - 2
.gitlab/ci/env_fedora35_makefiles.cmake

@@ -1,2 +0,0 @@
-set(ENV{MY_RUBY_HOME} "/usr/local/rvm/rubies/ruby-2.7.0")
-set(ENV{PATH} "/usr/lib64/mpich/bin:$ENV{PATH}")

+ 0 - 0
.gitlab/ci/env_fedora35_asan.sh → .gitlab/ci/env_fedora36_asan.sh


+ 0 - 0
.gitlab/ci/env_fedora35_clang_analyzer.sh → .gitlab/ci/env_fedora36_clang_analyzer.sh


+ 2 - 0
.gitlab/ci/env_fedora36_makefiles.cmake

@@ -0,0 +1,2 @@
+set(ENV{MY_RUBY_HOME} "/usr/local/rvm/rubies/ruby-3.0.4")
+set(ENV{PATH} "/usr/lib64/mpich/bin:$ENV{PATH}")

+ 29 - 29
.gitlab/os-linux.yml

@@ -5,7 +5,7 @@
 ### Release
 
 .linux_prep_source:
-    image: "fedora:35"
+    image: "fedora:36"
 
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -68,8 +68,8 @@
 
 ### Fedora
 
-.fedora35:
-    image: "kitware/cmake:ci-fedora35-x86_64-2022-04-22"
+.fedora36:
+    image: "kitware/cmake:ci-fedora36-x86_64-2022-05-17"
 
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
@@ -77,37 +77,37 @@
 
 #### Lint builds
 
-.fedora35_tidy:
-    extends: .fedora35
+.fedora36_tidy:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_tidy
+        CMAKE_CONFIGURATION: fedora36_tidy
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_CI_NO_INSTALL: 1
 
-.fedora35_clang_analyzer:
-    extends: .fedora35
+.fedora36_clang_analyzer:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_clang_analyzer
+        CMAKE_CONFIGURATION: fedora36_clang_analyzer
         CMAKE_CI_BUILD_TYPE: Debug
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_CI_NO_INSTALL: 1
 
-.fedora35_sphinx:
-    extends: .fedora35
+.fedora36_sphinx:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_sphinx
+        CMAKE_CONFIGURATION: fedora36_sphinx
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
         CMAKE_CI_NO_INSTALL: 1
 
-.fedora35_sphinx_package:
-    extends: .fedora35
+.fedora36_sphinx_package:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_sphinx_package
+        CMAKE_CONFIGURATION: fedora36_sphinx_package
         CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
 
 #### Build and test
@@ -137,27 +137,27 @@
         CMAKE_CI_NO_INSTALL: 1
         CTEST_NO_WARNINGS_ALLOWED: 1
 
-.fedora35_ninja:
-    extends: .fedora35
+.fedora36_ninja:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_ninja
+        CMAKE_CONFIGURATION: fedora36_ninja
         CMAKE_CI_BUILD_TYPE: Release
         CTEST_NO_WARNINGS_ALLOWED: 1
 
-.fedora35_ninja_multi:
-    extends: .fedora35
+.fedora36_ninja_multi:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_ninja_multi
+        CMAKE_CONFIGURATION: fedora36_ninja_multi
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_GENERATOR: "Ninja Multi-Config"
 
-.fedora35_makefiles:
-    extends: .fedora35
+.fedora36_makefiles:
+    extends: .fedora36
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_makefiles
+        CMAKE_CONFIGURATION: fedora36_makefiles
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_GENERATOR: "Unix Makefiles"
 
@@ -189,13 +189,13 @@
         CTEST_MEMORYCHECK_TYPE: AddressSanitizer
         CTEST_MEMORYCHECK_SANITIZER_OPTIONS: ""
 
-.fedora35_asan:
+.fedora36_asan:
     extends:
-        - .fedora35
+        - .fedora36
         - .fedora_asan_addon
 
     variables:
-        CMAKE_CONFIGURATION: fedora35_asan
+        CMAKE_CONFIGURATION: fedora36_asan
 
 ### Intel Compiler
 
@@ -389,7 +389,7 @@
 
 .cmake_codespell_linux:
     stage: build
-    extends: .fedora35
+    extends: .fedora36
     script:
         - codespell
     interruptible: true
@@ -532,7 +532,7 @@
 .cmake_org_help:
     stage: build
     extends:
-        - .fedora35
+        - .fedora36
         - .linux_builder_tags
         - .cmake_org_help_artifacts
     script:

+ 2 - 2
.gitlab/upload.yml

@@ -1,7 +1,7 @@
 # Steps for uploading artifacts
 
 .rsync_upload_package:
-    image: "fedora:35"
+    image: "fedora:36"
     stage: upload
     tags:
         - cmake
@@ -21,7 +21,7 @@
 
 .rsync_upload_help:
     stage: upload
-    image: "fedora:35"
+    image: "fedora:36"
     tags:
         - cmake
         - docker

+ 1 - 0
CTestCustom.cmake.in

@@ -98,6 +98,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
   "nghttp2/lib/.*:[0-9]+:[0-9]+: warning: Value stored to '[^']+' is never read"
   "zstd/lib/.*:[0-9]+:[0-9]+: warning: Assigned value is garbage or undefined"
   "zstd/lib/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
+  "zstd/lib/.*:[0-9]+:[0-9]+: warning: The right operand of .* is a garbage value due to array index out of bounds"
   )
 
 if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")

+ 1 - 1
Source/CPack/IFW/cmCPackIFWGenerator.cxx

@@ -468,7 +468,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
   const std::string suffix = "/data";
 
   if (this->componentPackageMethod == this->ONE_PACKAGE) {
-    return std::string(prefix + this->GetRootPackageName() + suffix);
+    return cmStrCat(prefix, this->GetRootPackageName(), suffix);
   }
 
   return prefix +

+ 1 - 2
Source/CPack/IFW/cmCPackIFWRepository.cxx

@@ -116,13 +116,12 @@ public:
   cmCPackeIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x)
     : repository(r)
     , xout(x)
-    , patched(false)
   {
   }
 
   cmCPackIFWRepository* repository;
   cmXMLWriter& xout;
-  bool patched;
+  bool patched = false;
 
 protected:
   void StartElement(const std::string& name, const char** atts) override

+ 1 - 1
Source/CPack/cmCPackDebGenerator.cxx

@@ -707,7 +707,7 @@ bool cmCPackDebGenerator::createDebPackages()
                           &cmCPackDebGenerator::createDbgsymDDeb) &&
       retval;
   }
-  return int(retval);
+  return static_cast<int>(retval);
 }
 
 bool cmCPackDebGenerator::createDeb()

+ 8 - 9
Source/CTest/cmCTestBZR.cxx

@@ -88,7 +88,6 @@ class cmCTestBZR::InfoParser : public cmCTestVC::LineParser
 public:
   InfoParser(cmCTestBZR* bzr, const char* prefix)
     : BZR(bzr)
-    , CheckOutFound(false)
   {
     this->SetLog(&bzr->Log, prefix);
     this->RegexCheckOut.compile("checkout of branch: *([^\t\r\n]+)$");
@@ -97,7 +96,7 @@ public:
 
 private:
   cmCTestBZR* BZR;
-  bool CheckOutFound;
+  bool CheckOutFound = false;
   cmsys::RegularExpression RegexCheckOut;
   cmsys::RegularExpression RegexParent;
   bool ProcessLine() override
@@ -255,26 +254,26 @@ private:
       this->BZR->DoRevision(this->Rev, this->Changes);
     } else if (!this->CData.empty() &&
                (name == "file" || name == "directory")) {
-      this->CurChange.Path.assign(&this->CData[0], this->CData.size());
+      this->CurChange.Path.assign(this->CData.data(), this->CData.size());
       cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
       this->Changes.push_back(this->CurChange);
     } else if (!this->CData.empty() && name == "symlink") {
       // symlinks have an arobase at the end in the log
-      this->CurChange.Path.assign(&this->CData[0], this->CData.size() - 1);
+      this->CurChange.Path.assign(this->CData.data(), this->CData.size() - 1);
       cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
       this->Changes.push_back(this->CurChange);
     } else if (!this->CData.empty() && name == "committer") {
-      this->Rev.Author.assign(&this->CData[0], this->CData.size());
+      this->Rev.Author.assign(this->CData.data(), this->CData.size());
       if (this->EmailRegex.find(this->Rev.Author)) {
         this->Rev.Author = this->EmailRegex.match(1);
         this->Rev.EMail = this->EmailRegex.match(2);
       }
     } else if (!this->CData.empty() && name == "timestamp") {
-      this->Rev.Date.assign(&this->CData[0], this->CData.size());
+      this->Rev.Date.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "message") {
-      this->Rev.Log.assign(&this->CData[0], this->CData.size());
+      this->Rev.Log.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "revno") {
-      this->Rev.Rev.assign(&this->CData[0], this->CData.size());
+      this->Rev.Rev.assign(this->CData.data(), this->CData.size());
     }
     this->CData.clear();
   }
@@ -389,7 +388,7 @@ bool cmCTestBZR::UpdateImpl()
   // For some reason bzr uses stderr to display the update status.
   OutputLogger out(this->Log, "pull-out> ");
   UpdateParser err(this, "pull-err> ");
-  return this->RunUpdateCommand(&bzr_update[0], &out, &err);
+  return this->RunUpdateCommand(bzr_update.data(), &out, &err);
 }
 
 bool cmCTestBZR::LoadRevisions()

+ 3 - 3
Source/CTest/cmCTestBinPacker.cxx

@@ -34,7 +34,7 @@ namespace {
  * more combinations can be tried.
  */
 template <typename AllocationStrategy>
-static bool AllocateCTestResources(
+bool AllocateCTestResources(
   const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
   const std::vector<std::string>& resourcesSorted, std::size_t currentIndex,
   std::vector<cmCTestBinPackerAllocation*>& allocations)
@@ -82,7 +82,7 @@ static bool AllocateCTestResources(
 }
 
 template <typename AllocationStrategy>
-static bool AllocateCTestResources(
+bool AllocateCTestResources(
   const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
   std::vector<cmCTestBinPackerAllocation>& allocations)
 {
@@ -108,7 +108,7 @@ static bool AllocateCTestResources(
 
   // Do the actual allocation
   return AllocateCTestResources<AllocationStrategy>(
-    resources, resourcesSorted, std::size_t(0), allocationsPtr);
+    resources, resourcesSorted, static_cast<std::size_t>(0), allocationsPtr);
 }
 
 class RoundRobinAllocationStrategy

+ 3 - 4
Source/CTest/cmCTestCVS.cxx

@@ -101,7 +101,7 @@ bool cmCTestCVS::UpdateImpl()
 
   UpdateParser out(this, "up-out> ");
   UpdateParser err(this, "up-err> ");
-  return this->RunUpdateCommand(&cvs_update[0], &out, &err);
+  return this->RunUpdateCommand(cvs_update.data(), &out, &err);
 }
 
 class cmCTestCVS::LogParser : public cmCTestVC::LineParser
@@ -111,7 +111,6 @@ public:
   LogParser(cmCTestCVS* cvs, const char* prefix, std::vector<Revision>& revs)
     : CVS(cvs)
     , Revisions(revs)
-    , Section(SectionHeader)
   {
     this->SetLog(&cvs->Log, prefix);
     this->RegexRevision.compile("^revision +([^ ]*) *$");
@@ -131,7 +130,7 @@ private:
     SectionRevisions,
     SectionEnd
   };
-  SectionType Section;
+  SectionType Section = SectionHeader;
   Revision Rev;
 
   bool ProcessLine() override
@@ -259,7 +258,7 @@ void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
     revisions.resize(2, this->Unknown);
 
     // Write the entry for this file with these revisions.
-    File f(fi.second, &revisions[0], &revisions[1]);
+    File f(fi.second, revisions.data(), revisions.data() + 1);
     this->WriteXMLEntry(xml, path, fi.first, full, f);
   }
   xml.EndElement(); // Directory

+ 1 - 1
Source/CTest/cmCTestCoverageHandler.cxx

@@ -2210,7 +2210,7 @@ int cmCTestCoverageHandler::GetLabelId(std::string const& label)
 {
   auto i = this->LabelIdMap.find(label);
   if (i == this->LabelIdMap.end()) {
-    int n = int(this->Labels.size());
+    int n = static_cast<int>(this->Labels.size());
     this->Labels.push_back(label);
     LabelIdMapType::value_type entry(label, n);
     i = this->LabelIdMap.insert(entry).first;

+ 6 - 7
Source/CTest/cmCTestGIT.cxx

@@ -176,7 +176,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
   // Fetch upstream refs.
   OutputLogger fetch_out(this->Log, "fetch-out> ");
   OutputLogger fetch_err(this->Log, "fetch-err> ");
-  if (!this->RunUpdateCommand(&git_fetch[0], &fetch_out, &fetch_err)) {
+  if (!this->RunUpdateCommand(git_fetch.data(), &fetch_out, &fetch_err)) {
     return false;
   }
 
@@ -225,7 +225,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom)
 
   OutputLogger custom_out(this->Log, "custom-out> ");
   OutputLogger custom_err(this->Log, "custom-err> ");
-  return this->RunUpdateCommand(&git_custom[0], &custom_out, &custom_err);
+  return this->RunUpdateCommand(git_custom.data(), &custom_out, &custom_err);
 }
 
 bool cmCTestGIT::UpdateInternal()
@@ -332,7 +332,6 @@ public:
   DiffParser(cmCTestGIT* git, const char* prefix)
     : LineParser('\0', false)
     , GIT(git)
-    , DiffField(DiffFieldNone)
   {
     this->SetLog(&git->Log, prefix);
   }
@@ -349,7 +348,7 @@ protected:
     DiffFieldSrc,
     DiffFieldDst
   };
-  DiffFieldType DiffField;
+  DiffFieldType DiffField = DiffFieldNone;
   Change CurChange;
 
   void DiffReset()
@@ -454,7 +453,6 @@ class cmCTestGIT::CommitParser : public cmCTestGIT::DiffParser
 public:
   CommitParser(cmCTestGIT* git, const char* prefix)
     : DiffParser(git, prefix)
-    , Section(SectionHeader)
   {
     this->Separator = SectionSep[this->Section];
   }
@@ -469,7 +467,7 @@ private:
     SectionCount
   };
   static char const SectionSep[SectionCount];
-  SectionType Section;
+  SectionType Section = SectionHeader;
   Revision Rev;
 
   struct Person
@@ -537,7 +535,8 @@ private:
 
   void NextSection()
   {
-    this->Section = SectionType((this->Section + 1) % SectionCount);
+    this->Section =
+      static_cast<SectionType>((this->Section + 1) % SectionCount);
     this->Separator = SectionSep[this->Section];
     if (this->Section == SectionHeader) {
       this->GIT->DoRevision(this->Rev, this->Changes);

+ 5 - 5
Source/CTest/cmCTestHG.cxx

@@ -157,7 +157,7 @@ bool cmCTestHG::UpdateImpl()
 
   OutputLogger out(this->Log, "update-out> ");
   OutputLogger err(this->Log, "update-err> ");
-  return this->RunUpdateCommand(&hg_update[0], &out, &err);
+  return this->RunUpdateCommand(hg_update.data(), &out, &err);
 }
 
 class cmCTestHG::LogParser
@@ -213,13 +213,13 @@ private:
     if (name == "logentry") {
       this->HG->DoRevision(this->Rev, this->Changes);
     } else if (!this->CData.empty() && name == "author") {
-      this->Rev.Author.assign(&this->CData[0], this->CData.size());
+      this->Rev.Author.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "email") {
-      this->Rev.EMail.assign(&this->CData[0], this->CData.size());
+      this->Rev.EMail.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "date") {
-      this->Rev.Date.assign(&this->CData[0], this->CData.size());
+      this->Rev.Date.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "msg") {
-      this->Rev.Log.assign(&this->CData[0], this->CData.size());
+      this->Rev.Log.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "files") {
       std::vector<std::string> paths = this->SplitCData();
       for (std::string const& path : paths) {

+ 2 - 1
Source/CTest/cmCTestMemCheckHandler.cxx

@@ -1207,7 +1207,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
 
       if (failure >= 0) {
         ostr << "<b>" << this->ResultStrings[failure] << "</b> ";
-        if (results.empty() || unsigned(failure) > results.size() - 1) {
+        if (results.empty() ||
+            static_cast<unsigned>(failure) > results.size() - 1) {
           results.push_back(1);
         } else {
           results[failure]++;

+ 11 - 12
Source/CTest/cmCTestP4.cxx

@@ -118,7 +118,6 @@ class cmCTestP4::DiffParser : public cmCTestVC::LineParser
 public:
   DiffParser(cmCTestP4* p4, const char* prefix)
     : P4(p4)
-    , AlreadyNotified(false)
   {
     this->SetLog(&this->P4->Log, prefix);
     this->RegexDiff.compile("^==== (.*)#[0-9]+ - (.*)");
@@ -126,7 +125,7 @@ public:
 
 private:
   cmCTestP4* P4;
-  bool AlreadyNotified;
+  bool AlreadyNotified = false;
   std::string CurrentPath;
   cmsys::RegularExpression RegexDiff;
 
@@ -161,7 +160,7 @@ cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
 
     UserParser out(this, "users-out> ");
     OutputLogger err(this->Log, "users-err> ");
-    this->RunChild(&p4_users[0], &out, &err);
+    this->RunChild(p4_users.data(), &out, &err);
 
     // The user should now be added to the map. Search again.
     it = this->Users.find(username);
@@ -193,7 +192,6 @@ public:
   DescribeParser(cmCTestP4* p4, const char* prefix)
     : LineParser('\n', false)
     , P4(p4)
-    , Section(SectionHeader)
   {
     this->SetLog(&this->P4->Log, prefix);
     this->RegexHeader.compile("^Change ([0-9]+) by (.+)@(.+) on (.*)$");
@@ -216,7 +214,7 @@ private:
     SectionDiff,
     SectionCount
   };
-  SectionType Section;
+  SectionType Section = SectionHeader;
   Revision Rev;
 
   bool ProcessLine() override
@@ -250,7 +248,8 @@ private:
       this->Rev = Revision();
     }
 
-    this->Section = SectionType((this->Section + 1) % SectionCount);
+    this->Section =
+      static_cast<SectionType>((this->Section + 1) % SectionCount);
   }
 
   void DoHeaderLine()
@@ -354,7 +353,7 @@ std::string cmCTestP4::GetWorkingRevision()
   IdentifyParser out(this, "p4_changes-out> ", rev);
   OutputLogger err(this->Log, "p4_changes-err> ");
 
-  bool result = this->RunChild(&p4_identify[0], &out, &err);
+  bool result = this->RunChild(p4_identify.data(), &out, &err);
 
   // If there was a problem contacting the server return "<unknown>"
   if (!result) {
@@ -418,7 +417,7 @@ bool cmCTestP4::LoadRevisions()
   OutputLogger err(this->Log, "p4_changes-err> ");
 
   this->ChangeLists.clear();
-  this->RunChild(&p4_changes[0], &out, &err);
+  this->RunChild(p4_changes.data(), &out, &err);
 
   if (this->ChangeLists.empty()) {
     return true;
@@ -435,7 +434,7 @@ bool cmCTestP4::LoadRevisions()
 
     DescribeParser outDescribe(this, "p4_describe-out> ");
     OutputLogger errDescribe(this->Log, "p4_describe-err> ");
-    this->RunChild(&p4_describe[0], &outDescribe, &errDescribe);
+    this->RunChild(p4_describe.data(), &outDescribe, &errDescribe);
   }
   return true;
 }
@@ -455,7 +454,7 @@ bool cmCTestP4::LoadModifications()
 
   DiffParser out(this, "p4_diff-out> ");
   OutputLogger err(this->Log, "p4_diff-err> ");
-  this->RunChild(&p4_diff[0], &out, &err);
+  this->RunChild(p4_diff.data(), &out, &err);
   return true;
 }
 
@@ -473,7 +472,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom)
   OutputLogger custom_out(this->Log, "p4_customsync-out> ");
   OutputLogger custom_err(this->Log, "p4_customsync-err> ");
 
-  return this->RunUpdateCommand(&p4_custom[0], &custom_out, &custom_err);
+  return this->RunUpdateCommand(p4_custom.data(), &custom_out, &custom_err);
 }
 
 bool cmCTestP4::UpdateImpl()
@@ -523,5 +522,5 @@ bool cmCTestP4::UpdateImpl()
   OutputLogger out(this->Log, "p4_sync-out> ");
   OutputLogger err(this->Log, "p4_sync-err> ");
 
-  return this->RunUpdateCommand(&p4_sync[0], &out, &err);
+  return this->RunUpdateCommand(p4_sync.data(), &out, &err);
 }

+ 6 - 6
Source/CTest/cmCTestSVN.cxx

@@ -286,9 +286,9 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
   args.push_back(nullptr);
 
   if (strcmp(parameters[0], "update") == 0) {
-    return this->RunUpdateCommand(&args[0], out, err);
+    return this->RunUpdateCommand(args.data(), out, err);
   }
-  return this->RunChild(&args[0], out, err);
+  return this->RunChild(args.data(), out, err);
 }
 
 class cmCTestSVN::LogParser
@@ -353,16 +353,16 @@ private:
     if (name == "logentry") {
       this->SVN->DoRevisionSVN(this->Rev, this->Changes);
     } else if (!this->CData.empty() && name == "path") {
-      std::string orig_path(&this->CData[0], this->CData.size());
+      std::string orig_path(this->CData.data(), this->CData.size());
       std::string new_path = this->SVNRepo.BuildLocalPath(orig_path);
       this->CurChange.Path.assign(new_path);
       this->Changes.push_back(this->CurChange);
     } else if (!this->CData.empty() && name == "author") {
-      this->Rev.Author.assign(&this->CData[0], this->CData.size());
+      this->Rev.Author.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "date") {
-      this->Rev.Date.assign(&this->CData[0], this->CData.size());
+      this->Rev.Date.assign(this->CData.data(), this->CData.size());
     } else if (!this->CData.empty() && name == "msg") {
-      this->Rev.Log.assign(&this->CData[0], this->CData.size());
+      this->Rev.Log.assign(this->CData.data(), this->CData.size());
     }
     this->CData.clear();
   }

+ 9 - 10
Source/CTest/cmCTestSubmitHandler.cxx

@@ -56,7 +56,7 @@ private:
   {
     std::string val;
     if (!this->CurrentValue.empty()) {
-      val.assign(&this->CurrentValue[0], this->CurrentValue.size());
+      val.assign(this->CurrentValue.data(), this->CurrentValue.size());
     }
     return val;
   }
@@ -124,7 +124,7 @@ void cmCTestSubmitHandler::Initialize()
 {
   // We submit all available parts by default.
   for (cmCTest::Part p = cmCTest::PartStart; p != cmCTest::PartCount;
-       p = cmCTest::Part(p + 1)) {
+       p = static_cast<cmCTest::Part>(p + 1)) {
     this->SubmitPart[p] = true;
   }
   this->HasWarnings = false;
@@ -730,15 +730,15 @@ int cmCTestSubmitHandler::ProcessHandler()
     return -1;
   }
 
-  if (getenv("HTTP_PROXY")) {
+  if (char const* proxy = getenv("HTTP_PROXY")) {
     this->HTTPProxyType = 1;
-    this->HTTPProxy = getenv("HTTP_PROXY");
+    this->HTTPProxy = proxy;
     if (getenv("HTTP_PROXY_PORT")) {
       this->HTTPProxy += ":";
       this->HTTPProxy += getenv("HTTP_PROXY_PORT");
     }
-    if (getenv("HTTP_PROXY_TYPE")) {
-      std::string type = getenv("HTTP_PROXY_TYPE");
+    if (char const* proxy_type = getenv("HTTP_PROXY_TYPE")) {
+      std::string type = proxy_type;
       // HTTP/SOCKS4/SOCKS5
       if (type == "HTTP") {
         this->HTTPProxyType = 1;
@@ -810,7 +810,7 @@ int cmCTestSubmitHandler::ProcessHandler()
 
   // Query parts for files to submit.
   for (cmCTest::Part p = cmCTest::PartStart; p != cmCTest::PartCount;
-       p = cmCTest::Part(p + 1)) {
+       p = static_cast<cmCTest::Part>(p + 1)) {
     // Skip parts we are not submitting.
     if (!this->SubmitPart[p]) {
       continue;
@@ -894,9 +894,8 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
 {
   // Check whether each part is selected.
   for (cmCTest::Part p = cmCTest::PartStart; p != cmCTest::PartCount;
-       p = cmCTest::Part(p + 1)) {
-    this->SubmitPart[p] =
-      (std::set<cmCTest::Part>::const_iterator(parts.find(p)) != parts.end());
+       p = static_cast<cmCTest::Part>(p + 1)) {
+    this->SubmitPart[p] = parts.find(p) != parts.end();
   }
 }
 

+ 2 - 1
Source/CTest/cmCTestTestHandler.cxx

@@ -586,7 +586,8 @@ void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed,
 {
   std::size_t total = passed.size() + failed.size();
 
-  float percent = float(passed.size()) * 100.0f / float(total);
+  float percent =
+    static_cast<float>(passed.size()) * 100.0f / static_cast<float>(total);
   if (!failed.empty() && percent > 99) {
     percent = 99;
   }

+ 1 - 1
Source/CTest/cmCTestVC.cxx

@@ -66,7 +66,7 @@ bool cmCTestVC::InitialCheckout(const std::string& command)
   this->Log << "--- Begin Initial Checkout ---\n";
   OutputLogger out(this->Log, "co-out> ");
   OutputLogger err(this->Log, "co-err> ");
-  bool result = this->RunChild(&vc_co[0], &out, &err, parent.c_str());
+  bool result = this->RunChild(vc_co.data(), &out, &err, parent.c_str());
   this->Log << "--- End Initial Checkout ---\n";
   if (!result) {
     cmCTestLog(this->CTest, ERROR_MESSAGE,

+ 2 - 2
Source/CursesDialog/cmCursesMainForm.cxx

@@ -617,7 +617,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
     cmValue existingValue =
       this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey);
     if (existingValue) {
-      std::string oldValue = *existingValue;
+      std::string const& oldValue = *existingValue;
       std::string newValue = entry.Entry->GetValue();
       std::string fixedOldValue;
       std::string fixedNewValue;
@@ -973,7 +973,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
         }
       }
     }
-    if (size_t(findex) >= 3 * this->NumberOfVisibleEntries - 1) {
+    if (static_cast<size_t>(findex) >= 3 * this->NumberOfVisibleEntries - 1) {
       set_current_field(this->Form, this->Fields[2]);
     } else if (new_page(this->Fields[findex + 1])) {
       form_driver(this->Form, REQ_NEXT_PAGE);

+ 3 - 4
Source/QtDialog/QCMakeCacheView.cxx

@@ -66,7 +66,6 @@ class QCMakeAdvancedFilter : public QSortFilterProxyModel
 public:
   QCMakeAdvancedFilter(QObject* o)
     : QSortFilterProxyModel(o)
-    , ShowAdvanced(false)
   {
   }
 
@@ -78,7 +77,7 @@ public:
   bool showAdvanced() const { return this->ShowAdvanced; }
 
 protected:
-  bool ShowAdvanced;
+  bool ShowAdvanced = false;
 
   bool filterAcceptsRow(int row, const QModelIndex& p) const override
   {
@@ -304,7 +303,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
 
       int num = props2.size();
       for (int i = 0; i < num; i++) {
-        QCMakeProperty prop = props2[i];
+        QCMakeProperty const& prop = props2[i];
         QList<QStandardItem*> items;
         items.append(new QStandardItem());
         items.append(new QStandardItem());
@@ -326,7 +325,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
 
       int num = props2.size();
       for (int i = 0; i < num; i++) {
-        QCMakeProperty prop = props2[i];
+        QCMakeProperty const& prop = props2[i];
         QList<QStandardItem*> items;
         items.append(new QStandardItem());
         items.append(new QStandardItem());

+ 0 - 1
Source/cmArchiveWrite.cxx

@@ -92,7 +92,6 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
   : Stream(os)
   , Archive(archive_write_new())
   , Disk(archive_read_disk_new())
-  , Verbose(false)
   , Format(format)
 {
   // Upstream fixed an issue with their integer parsing in 3.4.0

+ 1 - 1
Source/cmArchiveWrite.h

@@ -156,7 +156,7 @@ private:
   std::ostream& Stream;
   struct archive* Archive;
   struct archive* Disk;
-  bool Verbose;
+  bool Verbose = false;
   std::string Format;
   std::string Error;
   std::string MTime;

+ 20 - 17
Source/cmCTest.cxx

@@ -322,7 +322,7 @@ std::string cmCTest::DecodeURL(const std::string& in)
   for (const char* c = in.c_str(); *c; ++c) {
     if (*c == '%' && isxdigit(*(c + 1)) && isxdigit(*(c + 2))) {
       char buf[3] = { *(c + 1), *(c + 2), 0 };
-      out.append(1, char(strtoul(buf, nullptr, 16)));
+      out.append(1, static_cast<char>(strtoul(buf, nullptr, 16)));
       c += 2;
     } else {
       out.append(1, *c);
@@ -357,7 +357,7 @@ cmCTest::cmCTest()
   this->Impl->Parts[PartDone].SetName("Done");
 
   // Fill the part name-to-id map.
-  for (Part p = PartStart; p != PartCount; p = Part(p + 1)) {
+  for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
     this->Impl
       ->PartMap[cmSystemTools::LowerCase(this->Impl->Parts[p].GetName())] = p;
   }
@@ -643,7 +643,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
   std::string src_dir = this->GetCTestConfiguration("SourceDirectory");
   std::string bld_dir = this->GetCTestConfiguration("BuildDirectory");
   this->Impl->BuildID = "";
-  for (Part p = PartStart; p != PartCount; p = Part(p + 1)) {
+  for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
     this->Impl->Parts[p].SubmitFiles.clear();
   }
 
@@ -797,7 +797,7 @@ int cmCTest::GetTestModel() const
 bool cmCTest::SetTest(const std::string& ttype, bool report)
 {
   if (cmSystemTools::LowerCase(ttype) == "all") {
-    for (Part p = PartStart; p != PartCount; p = Part(p + 1)) {
+    for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
       this->Impl->Parts[p].Enable();
     }
     return true;
@@ -935,7 +935,8 @@ int cmCTest::ProcessSteps()
   bool notest = true;
   int update_count = 0;
 
-  for (Part p = PartStart; notest && p != PartCount; p = Part(p + 1)) {
+  for (Part p = PartStart; notest && p != PartCount;
+       p = static_cast<Part>(p + 1)) {
     notest = !this->Impl->Parts[p];
   }
   if (this->Impl->Parts[PartUpdate] &&
@@ -1672,16 +1673,16 @@ std::string cmCTest::Base64EncodeFile(std::string const& file)
 #endif
   );
   std::vector<char> file_buffer(len + 1);
-  ifs.read(&file_buffer[0], len);
+  ifs.read(file_buffer.data(), len);
   ifs.close();
 
   std::vector<char> encoded_buffer((len * 3) / 2 + 5);
 
   size_t const rlen = cmsysBase64_Encode(
-    reinterpret_cast<unsigned char*>(&file_buffer[0]), len,
-    reinterpret_cast<unsigned char*>(&encoded_buffer[0]), 1);
+    reinterpret_cast<unsigned char*>(file_buffer.data()), len,
+    reinterpret_cast<unsigned char*>(encoded_buffer.data()), 1);
 
-  return std::string(&encoded_buffer[0], rlen);
+  return std::string(encoded_buffer.data(), rlen);
 }
 
 bool cmCTest::SubmitExtraFiles(std::vector<std::string> const& files)
@@ -2019,7 +2020,8 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
     i++;
     long outputSize;
     if (cmStrToLong(args[i], &outputSize)) {
-      this->Impl->TestHandler.SetTestOutputSizePassed(int(outputSize));
+      this->Impl->TestHandler.SetTestOutputSizePassed(
+        static_cast<int>(outputSize));
     } else {
       cmCTestLog(this, WARNING,
                  "Invalid value for '--test-output-size-passed': " << args[i]
@@ -2030,7 +2032,8 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
     i++;
     long outputSize;
     if (cmStrToLong(args[i], &outputSize)) {
-      this->Impl->TestHandler.SetTestOutputSizeFailed(int(outputSize));
+      this->Impl->TestHandler.SetTestOutputSizeFailed(
+        static_cast<int>(outputSize));
     } else {
       cmCTestLog(this, WARNING,
                  "Invalid value for '--test-output-size-failed': " << args[i]
@@ -2801,7 +2804,7 @@ bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
                                        const std::vector<std::string>& args)
 {
   bool success = true;
-  std::string arg = args[i];
+  std::string const& arg = args[i];
   if (this->CheckArgument(arg, "-T"_s, "--test-action") &&
       (i < args.size() - 1)) {
     this->Impl->ProduceXML = true;
@@ -2833,7 +2836,7 @@ bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i,
                                       const std::vector<std::string>& args)
 {
   bool success = true;
-  std::string arg = args[i];
+  std::string const& arg = args[i];
   if (this->CheckArgument(arg, "-M"_s, "--test-model") &&
       (i < args.size() - 1)) {
     i++;
@@ -3729,7 +3732,7 @@ bool cmCTest::CompressString(std::string& str)
   strm.avail_in = static_cast<uInt>(str.size());
   strm.next_in = in;
   strm.avail_out = outSize;
-  strm.next_out = &out[0];
+  strm.next_out = out.data();
   ret = deflate(&strm, Z_FINISH);
 
   if (ret != Z_STREAM_END) {
@@ -3743,10 +3746,10 @@ bool cmCTest::CompressString(std::string& str)
   // Now base64 encode the resulting binary string
   std::vector<unsigned char> base64EncodedBuffer((outSize * 3) / 2);
 
-  size_t rlen =
-    cmsysBase64_Encode(&out[0], strm.total_out, &base64EncodedBuffer[0], 1);
+  size_t rlen = cmsysBase64_Encode(out.data(), strm.total_out,
+                                   base64EncodedBuffer.data(), 1);
 
-  str.assign(reinterpret_cast<char*>(&base64EncodedBuffer[0]), rlen);
+  str.assign(reinterpret_cast<char*>(base64EncodedBuffer.data()), rlen);
 
   return true;
 }

+ 26 - 17
Source/cmConditionEvaluator.cxx

@@ -95,7 +95,8 @@ struct cmRt2CtSelector<Comp>
 
 std::string bool2string(bool const value)
 {
-  return std::string(std::size_t(1), static_cast<char>('0' + int(value)));
+  return std::string(static_cast<std::size_t>(1),
+                     static_cast<char>('0' + static_cast<int>(value)));
 }
 
 bool looksLikeSpecialVariable(const std::string& var,
@@ -141,15 +142,17 @@ public:
     {
       this->current = std::next(this->current);
       this->next =
-        std::next(this->current, difference_type(this->current != args.end()));
+        std::next(this->current,
+                  static_cast<difference_type>(this->current != args.end()));
       return *this;
     }
 
   private:
     CurrentAndNextIter(base_t& args)
       : current(args.begin())
-      , next(std::next(this->current,
-                       difference_type(this->current != args.end())))
+      , next(
+          std::next(this->current,
+                    static_cast<difference_type>(this->current != args.end())))
     {
     }
   };
@@ -167,19 +170,21 @@ public:
     {
       this->current = std::next(this->current);
       this->next =
-        std::next(this->current, difference_type(this->current != args.end()));
-      this->nextnext =
-        std::next(this->next, difference_type(this->next != args.end()));
+        std::next(this->current,
+                  static_cast<difference_type>(this->current != args.end()));
+      this->nextnext = std::next(
+        this->next, static_cast<difference_type>(this->next != args.end()));
       return *this;
     }
 
   private:
     CurrentAndTwoMoreIter(base_t& args)
       : current(args.begin())
-      , next(std::next(this->current,
-                       difference_type(this->current != args.end())))
-      , nextnext(
-          std::next(this->next, difference_type(this->next != args.end())))
+      , next(
+          std::next(this->current,
+                    static_cast<difference_type>(this->current != args.end())))
+      , nextnext(std::next(
+          this->next, static_cast<difference_type>(this->next != args.end())))
     {
     }
   };
@@ -580,7 +585,8 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
     // does a command exist
     else if (this->IsKeyword(keyCOMMAND, *args.current)) {
       newArgs.ReduceOneArg(
-        bool(this->Makefile.GetState()->GetCommand(args.next->GetValue())),
+        static_cast<bool>(
+          this->Makefile.GetState()->GetCommand(args.next->GetValue())),
         args);
     }
     // does a policy exist
@@ -591,8 +597,9 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
     }
     // does a target exist
     else if (this->IsKeyword(keyTARGET, *args.current)) {
-      newArgs.ReduceOneArg(
-        bool(this->Makefile.FindTargetToUse(args.next->GetValue())), args);
+      newArgs.ReduceOneArg(static_cast<bool>(this->Makefile.FindTargetToUse(
+                             args.next->GetValue())),
+                           args);
     }
     // is a variable defined
     else if (this->IsKeyword(keyDEFINED, *args.current)) {
@@ -607,7 +614,8 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
 
       else if (looksLikeSpecialVariable(var, "CACHE"_s, varNameLen)) {
         const auto cache = args.next->GetValue().substr(6, varNameLen - 7);
-        result = bool(this->Makefile.GetState()->GetCacheEntryValue(cache));
+        result = static_cast<bool>(
+          this->Makefile.GetState()->GetCacheEntryValue(cache));
       }
 
       else {
@@ -620,8 +628,9 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
       if (policy64IsOld) {
         continue;
       }
-      newArgs.ReduceOneArg(bool(this->Makefile.GetTest(args.next->GetValue())),
-                           args);
+      newArgs.ReduceOneArg(
+        static_cast<bool>(this->Makefile.GetTest(args.next->GetValue())),
+        args);
     }
   }
   return true;

+ 5 - 9
Source/cmCoreTryCompile.cxx

@@ -32,11 +32,7 @@ class LanguageStandardState
 {
 public:
   LanguageStandardState(std::string&& lang)
-    : IsEnabled(false)
-    , DidStandard(false)
-    , DidStandardRequired(false)
-    , DidExtensions(false)
-    , StandardFlag(lang + "_STANDARD")
+    : StandardFlag(lang + "_STANDARD")
     , RequiredFlag(lang + "_STANDARD_REQUIRED")
     , ExtensionFlag(lang + "_EXTENSIONS")
   {
@@ -154,10 +150,10 @@ public:
   }
 
 private:
-  bool IsEnabled;
-  bool DidStandard;
-  bool DidStandardRequired;
-  bool DidExtensions;
+  bool IsEnabled = false;
+  bool DidStandard = false;
+  bool DidStandardRequired = false;
+  bool DidExtensions = false;
 
   std::string StandardFlag;
   std::string RequiredFlag;

+ 4 - 4
Source/cmCryptoHash.cxx

@@ -83,15 +83,15 @@ std::unique_ptr<cmCryptoHash> cmCryptoHash::New(cm::string_view algo)
 bool cmCryptoHash::IntFromHexDigit(char input, char& output)
 {
   if (input >= '0' && input <= '9') {
-    output = char(input - '0');
+    output = static_cast<char>(input - '0');
     return true;
   }
   if (input >= 'a' && input <= 'f') {
-    output = char(input - 'a' + 0xA);
+    output = static_cast<char>(input - 'a' + 0xA);
     return true;
   }
   if (input >= 'A' && input <= 'F') {
-    output = char(input - 'A' + 0xA);
+    output = static_cast<char>(input - 'A' + 0xA);
     return true;
   }
   return false;
@@ -182,7 +182,7 @@ void cmCryptoHash::Append(cm::string_view input)
 std::vector<unsigned char> cmCryptoHash::Finalize()
 {
   std::vector<unsigned char> hash(rhash_get_digest_size(this->Id), 0);
-  rhash_final(this->CTX, &hash[0]);
+  rhash_final(this->CTX, hash.data());
   return hash;
 }
 

+ 1 - 1
Source/cmDependsFortran.cxx

@@ -478,7 +478,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
   // when the interface described in the module does not.
 
   std::string mod = args[2];
-  std::string stamp = args[3];
+  std::string const& stamp = args[3];
   std::string compilerId;
   if (args.size() >= 5) {
     compilerId = args[4];

+ 1 - 2
Source/cmELF.cxx

@@ -83,7 +83,6 @@ public:
     : External(external)
     , Stream(std::move(fin))
     , ByteOrder(order)
-    , ELFType(cmELF::FileTypeInvalid)
   {
 // In most cases the processor-specific byte order will match that
 // of the target execution environment.  If we choose wrong here
@@ -150,7 +149,7 @@ protected:
   ByteOrderType ByteOrder;
 
   // The ELF file type.
-  cmELF::FileType ELFType;
+  cmELF::FileType ELFType = cmELF::FileTypeInvalid;
 
   // The ELF architecture.
   std::uint16_t Machine;

+ 1 - 1
Source/cmExtraEclipseCDT4Generator.cxx

@@ -737,7 +737,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     // exclude source directory from output search path
     // - only if not named the same as an output directory
     if (!cmSystemTools::FileIsDirectory(
-          std::string(this->HomeOutputDirectory + "/" + p))) {
+          cmStrCat(this->HomeOutputDirectory, '/', p))) {
       excludeFromOut += p + "/|";
     }
   }

+ 1 - 1
Source/cmFileAPI.cxx

@@ -417,7 +417,7 @@ const char* cmFileAPI::ObjectKindName(ObjectKind kind)
     "toolchains", //
     "__test"      //
   };
-  return objectKindNames[size_t(kind)];
+  return objectKindNames[static_cast<size_t>(kind)];
 }
 
 std::string cmFileAPI::ObjectName(Object const& o)

+ 2 - 2
Source/cmFileCommand.cxx

@@ -285,7 +285,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
   }
 
   // Get the variable in which to store the results.
-  std::string outVar = args[2];
+  std::string const& outVar = args[2];
 
   // Parse the options.
   enum
@@ -1870,7 +1870,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
       }
       std::string algo = i->substr(0, pos);
       expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1));
-      hash = std::unique_ptr<cmCryptoHash>(cmCryptoHash::New(algo));
+      hash = cmCryptoHash::New(algo);
       if (!hash) {
         std::string err =
           cmStrCat("DOWNLOAD EXPECTED_HASH given unknown ALGO: ", algo);

+ 0 - 10
Source/cmFileCopier.cxx

@@ -27,16 +27,6 @@ cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name)
   : Status(status)
   , Makefile(&status.GetMakefile())
   , Name(name)
-  , Always(false)
-  , MatchlessFiles(true)
-  , FilePermissions(0)
-  , DirPermissions(0)
-  , CurrentMatchRule(nullptr)
-  , UseGivenPermissionsFile(false)
-  , UseGivenPermissionsDir(false)
-  , UseSourcePermissions(true)
-  , FollowSymlinkChain(false)
-  , Doing(DoingNone)
 {
 }
 

+ 12 - 11
Source/cmFileCopier.h

@@ -28,15 +28,15 @@ protected:
   cmExecutionStatus& Status;
   cmMakefile* Makefile;
   const char* Name;
-  bool Always;
+  bool Always = false;
   cmFileTimeCache FileTimes;
 
   // Whether to install a file not matching any expression.
-  bool MatchlessFiles;
+  bool MatchlessFiles = true;
 
   // Permissions for files and directories installed by this object.
-  mode_t FilePermissions;
-  mode_t DirPermissions;
+  mode_t FilePermissions = 0;
+  mode_t DirPermissions = 0;
 
   // Properties set by pattern and regex match rules.
   struct MatchProperties
@@ -85,17 +85,15 @@ protected:
   virtual void ReportCopy(const std::string&, Type, bool) {}
   virtual bool ReportMissing(const std::string& fromFile);
 
-  MatchRule* CurrentMatchRule;
-  bool UseGivenPermissionsFile;
-  bool UseGivenPermissionsDir;
-  bool UseSourcePermissions;
-  bool FollowSymlinkChain;
+  MatchRule* CurrentMatchRule = nullptr;
+  bool UseGivenPermissionsFile = false;
+  bool UseGivenPermissionsDir = false;
+  bool UseSourcePermissions = true;
+  bool FollowSymlinkChain = false;
   std::string Destination;
   std::string FilesFromDir;
   std::vector<std::string> Files;
-  int Doing;
 
-  virtual bool Parse(std::vector<std::string> const& args);
   enum
   {
     DoingNone,
@@ -110,6 +108,9 @@ protected:
     DoingPermissionsMatch,
     DoingLast1
   };
+  int Doing = DoingNone;
+
+  virtual bool Parse(std::vector<std::string> const& args);
   virtual bool CheckKeyword(std::string const& arg);
   virtual bool CheckValue(std::string const& arg);
 

+ 1 - 8
Source/cmFileInstaller.cxx

@@ -23,13 +23,6 @@ using namespace cmFSPermissions;
 
 cmFileInstaller::cmFileInstaller(cmExecutionStatus& status)
   : cmFileCopier(status, "INSTALL")
-  , InstallType(cmInstallType_FILES)
-  , InstallMode(cmInstallMode::COPY)
-  , Optional(false)
-  , MessageAlways(false)
-  , MessageLazy(false)
-  , MessageNever(false)
-  , DestDirLength(0)
 {
   // Installation does not use source permissions by default.
   this->UseSourcePermissions = false;
@@ -440,7 +433,7 @@ bool cmFileInstaller::HandleInstallDestination()
       }
     }
     destination = sdestdir + destination.substr(skip);
-    this->DestDirLength = int(sdestdir.size());
+    this->DestDirLength = static_cast<int>(sdestdir.size());
   }
 
   // check if default dir creation permissions were set

+ 7 - 7
Source/cmFileInstaller.h

@@ -19,13 +19,13 @@ struct cmFileInstaller : public cmFileCopier
   ~cmFileInstaller() override;
 
 protected:
-  cmInstallType InstallType;
-  cmInstallMode InstallMode;
-  bool Optional;
-  bool MessageAlways;
-  bool MessageLazy;
-  bool MessageNever;
-  int DestDirLength;
+  cmInstallType InstallType = cmInstallType_FILES;
+  cmInstallMode InstallMode = cmInstallMode::COPY;
+  bool Optional = false;
+  bool MessageAlways = false;
+  bool MessageLazy = false;
+  bool MessageNever = false;
+  int DestDirLength = 0;
   std::string Rename;
 
   std::string Manifest;

+ 2 - 2
Source/cmForEachCommand.cxx

@@ -460,8 +460,8 @@ bool cmForEachCommand(std::vector<std::string> const& args,
       // in the `fb->Args` vector. The first item is the iteration variable
       // name...
       const std::size_t iter_cnt = 2u +
-        int(start < stop) * (stop - start) / std::abs(step) +
-        int(start > stop) * (start - stop) / std::abs(step);
+        static_cast<int>(start < stop) * (stop - start) / std::abs(step) +
+        static_cast<int>(start > stop) * (start - stop) / std::abs(step);
       fb->Args.resize(iter_cnt);
       fb->Args.front() = args.front();
       auto cc = start;

+ 1 - 2
Source/cmFortranParser.h

@@ -123,13 +123,12 @@ struct cmFortranFile
     : File(file)
     , Buffer(buffer)
     , Directory(std::move(dir))
-    , LastCharWasNewline(false)
   {
   }
   FILE* File;
   YY_BUFFER_STATE Buffer;
   std::string Directory;
-  bool LastCharWasNewline;
+  bool LastCharWasNewline = false;
 };
 
 struct cmFortranCompiler

+ 2 - 1
Source/cmGeneratedFileStream.cxx

@@ -44,7 +44,8 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
 #endif
   if (encoding == codecvt::UTF8_WITH_BOM) {
     // Write the BOM encoding header into the file
-    char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
+    char magic[] = { static_cast<char>(0xEF), static_cast<char>(0xBB),
+                     static_cast<char>(0xBF) };
     this->write(magic, 3);
   }
 }

+ 0 - 5
Source/cmGeneratorExpression.cxx

@@ -100,11 +100,6 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
   cmListFileBacktrace backtrace, std::string input)
   : Backtrace(std::move(backtrace))
   , Input(std::move(input))
-  , EvaluateForBuildsystem(false)
-  , Quiet(false)
-  , HadContextSensitiveCondition(false)
-  , HadHeadSensitiveCondition(false)
-  , HadLinkLanguageSensitiveCondition(false)
 {
   cmGeneratorExpressionLexer l;
   std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input);

+ 5 - 5
Source/cmGeneratorExpression.h

@@ -161,8 +161,8 @@ private:
   std::vector<std::unique_ptr<cmGeneratorExpressionEvaluator>> Evaluators;
   const std::string Input;
   bool NeedsEvaluation;
-  bool EvaluateForBuildsystem;
-  bool Quiet;
+  bool EvaluateForBuildsystem = false;
+  bool Quiet = false;
 
   mutable std::set<cmGeneratorTarget*> DependTargets;
   mutable std::set<cmGeneratorTarget const*> AllTargetsSeen;
@@ -171,9 +171,9 @@ private:
                    std::map<std::string, std::string>>
     MaxLanguageStandard;
   mutable std::string Output;
-  mutable bool HadContextSensitiveCondition;
-  mutable bool HadHeadSensitiveCondition;
-  mutable bool HadLinkLanguageSensitiveCondition;
+  mutable bool HadContextSensitiveCondition = false;
+  mutable bool HadHeadSensitiveCondition = false;
+  mutable bool HadLinkLanguageSensitiveCondition = false;
   mutable std::set<cmGeneratorTarget const*> SourceSensitiveTargets;
 };
 

+ 0 - 4
Source/cmGeneratorExpressionContext.cxx

@@ -16,10 +16,6 @@ cmGeneratorExpressionContext::cmGeneratorExpressionContext(
   , HeadTarget(headTarget)
   , CurrentTarget(currentTarget)
   , Quiet(quiet)
-  , HadError(false)
-  , HadContextSensitiveCondition(false)
-  , HadHeadSensitiveCondition(false)
-  , HadLinkLanguageSensitiveCondition(false)
   , EvaluateForBuildsystem(evaluateForBuildsystem)
 {
 }

+ 4 - 4
Source/cmGeneratorExpressionContext.h

@@ -36,9 +36,9 @@ struct cmGeneratorExpressionContext
   // directly or indirectly in the property.
   cmGeneratorTarget const* CurrentTarget;
   bool Quiet;
-  bool HadError;
-  bool HadContextSensitiveCondition;
-  bool HadHeadSensitiveCondition;
-  bool HadLinkLanguageSensitiveCondition;
+  bool HadError = false;
+  bool HadContextSensitiveCondition = false;
+  bool HadHeadSensitiveCondition = false;
+  bool HadLinkLanguageSensitiveCondition = false;
   bool EvaluateForBuildsystem;
 };

+ 5 - 5
Source/cmGeneratorExpressionNode.cxx

@@ -413,7 +413,7 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode
       return std::string();
     }
 
-    std::string targetName = parameters.front();
+    std::string const& targetName = parameters.front();
     if (targetName.empty() ||
         !cmGeneratorExpression::IsValidTargetName(targetName)) {
       reportError(context, content->GetOriginalExpression(),
@@ -445,7 +445,7 @@ static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode
       return std::string();
     }
 
-    std::string targetName = parameters.front();
+    std::string const& targetName = parameters.front();
     if (targetName.empty() ||
         !cmGeneratorExpression::IsValidTargetName(targetName)) {
       reportError(context, content->GetOriginalExpression(),
@@ -1759,7 +1759,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
     const GeneratorExpressionContent* content,
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
-    std::string tgtName = parameters.front();
+    std::string const& tgtName = parameters.front();
     cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
     if (!gt) {
       std::ostringstream e;
@@ -1847,7 +1847,7 @@ static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode
     const GeneratorExpressionContent* content,
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
-    std::string tgtName = parameters.front();
+    std::string const& tgtName = parameters.front();
     cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
     if (!gt) {
       std::ostringstream e;
@@ -2396,7 +2396,7 @@ protected:
     cmGeneratorExpressionDAGChecker* dagChecker) const
   {
     // Lookup the referenced target.
-    std::string name = parameters.front();
+    std::string const& name = parameters.front();
 
     if (!cmGeneratorExpression::IsValidTargetName(name)) {
       ::reportError(context, content->GetOriginalExpression(),

+ 0 - 1
Source/cmGeneratorExpressionParser.cxx

@@ -15,7 +15,6 @@
 cmGeneratorExpressionParser::cmGeneratorExpressionParser(
   std::vector<cmGeneratorExpressionToken> tokens)
   : Tokens(std::move(tokens))
-  , NestingLevel(0)
 {
 }
 

+ 1 - 1
Source/cmGeneratorExpressionParser.h

@@ -26,5 +26,5 @@ private:
 
   std::vector<cmGeneratorExpressionToken>::const_iterator it;
   const std::vector<cmGeneratorExpressionToken> Tokens;
-  unsigned int NestingLevel;
+  unsigned int NestingLevel = 0;
 };

+ 2 - 17
Source/cmGeneratorTarget.cxx

@@ -335,20 +335,6 @@ EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
 
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
   : Target(t)
-  , FortranModuleDirectoryCreated(false)
-  , SourceFileFlagsConstructed(false)
-  , PolicyWarnedCMP0022(false)
-  , PolicyReportedCMP0069(false)
-  , DebugIncludesDone(false)
-  , DebugCompileOptionsDone(false)
-  , DebugCompileFeaturesDone(false)
-  , DebugCompileDefinitionsDone(false)
-  , DebugLinkOptionsDone(false)
-  , DebugLinkDirectoriesDone(false)
-  , DebugPrecompileHeadersDone(false)
-  , DebugSourcesDone(false)
-  , UtilityItemsDone(false)
-  , SourcesAreContextDependent(Tribool::Indeterminate)
 {
   this->Makefile = this->Target->GetMakefile();
   this->LocalGenerator = lg;
@@ -2775,15 +2761,14 @@ cmGeneratorTarget::LinkClosure const* cmGeneratorTarget::GetLinkClosure(
 
 class cmTargetSelectLinker
 {
-  int Preference;
+  int Preference = 0;
   cmGeneratorTarget const* Target;
   cmGlobalGenerator* GG;
   std::set<std::string> Preferred;
 
 public:
   cmTargetSelectLinker(cmGeneratorTarget const* target)
-    : Preference(0)
-    , Target(target)
+    : Target(target)
   {
     this->GG = this->Target->GetLocalGenerator()->GetGlobalGenerator();
   }

+ 14 - 14
Source/cmGeneratorTarget.h

@@ -881,7 +881,7 @@ private:
 
   std::string CreateFortranModuleDirectory(
     std::string const& working_dir) const;
-  mutable bool FortranModuleDirectoryCreated;
+  mutable bool FortranModuleDirectoryCreated = false;
   mutable std::string FortranModuleDirectory;
 
   friend class cmTargetTraceDependencies;
@@ -906,7 +906,7 @@ private:
   mutable std::string ExportMacro;
 
   void ConstructSourceFileFlags() const;
-  mutable bool SourceFileFlagsConstructed;
+  mutable bool SourceFileFlagsConstructed = false;
   mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
 
   mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
@@ -1143,24 +1143,24 @@ private:
   mutable OutputNameMapType OutputNameMap;
   mutable std::set<cmLinkItem> UtilityItems;
   cmPolicies::PolicyMap PolicyMap;
-  mutable bool PolicyWarnedCMP0022;
-  mutable bool PolicyReportedCMP0069;
-  mutable bool DebugIncludesDone;
-  mutable bool DebugCompileOptionsDone;
-  mutable bool DebugCompileFeaturesDone;
-  mutable bool DebugCompileDefinitionsDone;
-  mutable bool DebugLinkOptionsDone;
-  mutable bool DebugLinkDirectoriesDone;
-  mutable bool DebugPrecompileHeadersDone;
-  mutable bool DebugSourcesDone;
-  mutable bool UtilityItemsDone;
+  mutable bool PolicyWarnedCMP0022 = false;
+  mutable bool PolicyReportedCMP0069 = false;
+  mutable bool DebugIncludesDone = false;
+  mutable bool DebugCompileOptionsDone = false;
+  mutable bool DebugCompileFeaturesDone = false;
+  mutable bool DebugCompileDefinitionsDone = false;
+  mutable bool DebugLinkOptionsDone = false;
+  mutable bool DebugLinkDirectoriesDone = false;
+  mutable bool DebugPrecompileHeadersDone = false;
+  mutable bool DebugSourcesDone = false;
+  mutable bool UtilityItemsDone = false;
   enum class Tribool
   {
     False = 0x0,
     True = 0x1,
     Indeterminate = 0x2
   };
-  mutable Tribool SourcesAreContextDependent;
+  mutable Tribool SourcesAreContextDependent = Tribool::Indeterminate;
 
   bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
                            std::string& out) const;

+ 1 - 1
Source/cmGetPropertyCommand.cxx

@@ -71,7 +71,7 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
   }
 
   // The cmake variable in which to store the result.
-  const std::string variable = args[0];
+  std::string const& variable = args[0];
 
   std::string name;
   std::string propertyName;

+ 4 - 1
Source/cmGlobalGenerator.cxx

@@ -1152,7 +1152,10 @@ std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
 {
   // if there is an extension and it starts with . then move past the
   // . because the extensions are not stored with a .  in the map
-  if (ext && *ext == '.') {
+  if (!ext) {
+    return "";
+  }
+  if (*ext == '.') {
     ++ext;
   }
   auto const it = this->ExtensionToLanguage.find(ext);

+ 0 - 12
Source/cmGraphVizWriter.cxx

@@ -109,18 +109,6 @@ cmGraphVizWriter::cmGraphVizWriter(std::string const& fileName,
   , GraphHeader("node [\n  fontsize = \"12\"\n];")
   , GraphNodePrefix("node")
   , GlobalGenerator(globalGenerator)
-  , NextNodeId(0)
-  , GenerateForExecutables(true)
-  , GenerateForStaticLibs(true)
-  , GenerateForSharedLibs(true)
-  , GenerateForModuleLibs(true)
-  , GenerateForInterfaceLibs(true)
-  , GenerateForObjectLibs(true)
-  , GenerateForUnknownLibs(true)
-  , GenerateForCustomTargets(false)
-  , GenerateForExternals(true)
-  , GeneratePerTarget(true)
-  , GenerateDependers(true)
 {
 }
 

+ 12 - 12
Source/cmGraphVizWriter.h

@@ -119,19 +119,19 @@ private:
 
   cmGlobalGenerator const* GlobalGenerator;
 
-  int NextNodeId;
+  int NextNodeId = 0;
   // maps from the actual item names to node names in dot:
   std::map<std::string, std::string> NodeNames;
 
-  bool GenerateForExecutables;
-  bool GenerateForStaticLibs;
-  bool GenerateForSharedLibs;
-  bool GenerateForModuleLibs;
-  bool GenerateForInterfaceLibs;
-  bool GenerateForObjectLibs;
-  bool GenerateForUnknownLibs;
-  bool GenerateForCustomTargets;
-  bool GenerateForExternals;
-  bool GeneratePerTarget;
-  bool GenerateDependers;
+  bool GenerateForExecutables = true;
+  bool GenerateForStaticLibs = true;
+  bool GenerateForSharedLibs = true;
+  bool GenerateForModuleLibs = true;
+  bool GenerateForInterfaceLibs = true;
+  bool GenerateForObjectLibs = true;
+  bool GenerateForUnknownLibs = true;
+  bool GenerateForCustomTargets = false;
+  bool GenerateForExternals = true;
+  bool GeneratePerTarget = true;
+  bool GenerateDependers = true;
 };

+ 0 - 1
Source/cmInstallDirectoryGenerator.cxx

@@ -20,7 +20,6 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
   bool optional, cmListFileBacktrace backtrace)
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all, false, std::move(backtrace))
-  , LocalGenerator(nullptr)
   , Directories(dirs)
   , FilePermissions(std::move(file_permissions))
   , DirPermissions(std::move(dir_permissions))

+ 1 - 1
Source/cmInstallDirectoryGenerator.h

@@ -42,7 +42,7 @@ protected:
   void AddDirectoryInstallRule(std::ostream& os, const std::string& config,
                                Indent indent,
                                std::vector<std::string> const& dirs);
-  cmLocalGenerator* LocalGenerator;
+  cmLocalGenerator* LocalGenerator = nullptr;
   std::vector<std::string> const Directories;
   std::string const FilePermissions;
   std::string const DirPermissions;

+ 0 - 1
Source/cmInstallExportGenerator.cxx

@@ -32,7 +32,6 @@ cmInstallExportGenerator::cmInstallExportGenerator(
   , FileName(std::move(filename))
   , Namespace(std::move(name_space))
   , ExportOld(exportOld)
-  , LocalGenerator(nullptr)
 {
   if (android) {
 #ifndef CMAKE_BOOTSTRAP

+ 1 - 1
Source/cmInstallExportGenerator.h

@@ -65,7 +65,7 @@ protected:
   std::string const FileName;
   std::string const Namespace;
   bool const ExportOld;
-  cmLocalGenerator* LocalGenerator;
+  cmLocalGenerator* LocalGenerator = nullptr;
 
   std::string TempDir;
   std::string MainImportFile;

+ 0 - 1
Source/cmInstallFilesGenerator.cxx

@@ -19,7 +19,6 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
   bool optional, cmListFileBacktrace backtrace)
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all, false, std::move(backtrace))
-  , LocalGenerator(nullptr)
   , Files(files)
   , FilePermissions(std::move(file_permissions))
   , Rename(std::move(rename))

+ 1 - 1
Source/cmInstallFilesGenerator.h

@@ -44,7 +44,7 @@ protected:
                            Indent indent,
                            std::vector<std::string> const& files);
 
-  cmLocalGenerator* LocalGenerator;
+  cmLocalGenerator* LocalGenerator = nullptr;
   std::vector<std::string> const Files;
   std::string const FilePermissions;
   std::string const Rename;

+ 0 - 1
Source/cmInstallScriptGenerator.cxx

@@ -20,7 +20,6 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(
                        std::move(backtrace))
   , Script(std::move(script))
   , Code(code)
-  , AllowGenex(false)
 {
   // We need per-config actions if the script has generator expressions.
   if (cmGeneratorExpression::Find(this->Script) != std::string::npos) {

+ 1 - 1
Source/cmInstallScriptGenerator.h

@@ -41,5 +41,5 @@ protected:
   std::string const Script;
   bool const Code;
   cmLocalGenerator* LocalGenerator;
-  bool AllowGenex;
+  bool AllowGenex = false;
 };

+ 0 - 1
Source/cmInstallTargetGenerator.cxx

@@ -50,7 +50,6 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
   : cmInstallGenerator(dest, configurations, component, message,
                        exclude_from_all, false, std::move(backtrace))
   , TargetName(std::move(targetName))
-  , Target(nullptr)
   , FilePermissions(std::move(file_permissions))
   , ImportLibrary(implib)
   , Optional(optional)

+ 1 - 1
Source/cmInstallTargetGenerator.h

@@ -118,7 +118,7 @@ protected:
   void IssueCMP0095Warning(const std::string& unescapedRpath);
 
   std::string const TargetName;
-  cmGeneratorTarget* Target;
+  cmGeneratorTarget* Target = nullptr;
   std::string const FilePermissions;
   NamelinkModeType NamelinkMode;
   bool const ImportLibrary;

+ 0 - 4
Source/cmLinkLineComputer.cxx

@@ -18,10 +18,6 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
                                        cmStateDirectory const& stateDir)
   : StateDir(stateDir)
   , OutputConverter(outputConverter)
-  , ForResponse(false)
-  , UseWatcomQuote(false)
-  , UseNinjaMulti(false)
-  , Relink(false)
 {
 }
 

+ 4 - 4
Source/cmLinkLineComputer.h

@@ -67,8 +67,8 @@ protected:
   cmStateDirectory StateDir;
   cmOutputConverter* OutputConverter;
 
-  bool ForResponse;
-  bool UseWatcomQuote;
-  bool UseNinjaMulti;
-  bool Relink;
+  bool ForResponse = false;
+  bool UseWatcomQuote = false;
+  bool UseNinjaMulti = false;
+  bool Relink = false;
 };

+ 10 - 9
Source/cmListCommand.cxx

@@ -229,7 +229,7 @@ bool HandleAppendCommand(std::vector<std::string> const& args,
   // If `listString` or `args` is empty, no need to append `;`,
   // then index is going to be `1` and points to the end-of-string ";"
   auto const offset =
-    std::string::size_type(listString.empty() || args.empty());
+    static_cast<std::string::size_type>(listString.empty() || args.empty());
   listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";");
 
   makefile.AddDefinition(listName, listString);
@@ -255,7 +255,7 @@ bool HandlePrependCommand(std::vector<std::string> const& args,
   // If `listString` or `args` is empty, no need to append `;`,
   // then `offset` is going to be `1` and points to the end-of-string ";"
   auto const offset =
-    std::string::size_type(listString.empty() || args.empty());
+    static_cast<std::string::size_type>(listString.empty() || args.empty());
   listString.insert(0,
                     cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]);
 
@@ -1199,7 +1199,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
   const std::string messageHint = "sub-command SORT ";
 
   while (argumentIndex < args.size()) {
-    const std::string option = args[argumentIndex++];
+    std::string const& option = args[argumentIndex++];
     if (option == "COMPARE") {
       if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) {
         std::string error = cmStrCat(messageHint, "option \"", option,
@@ -1208,7 +1208,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
         return false;
       }
       if (argumentIndex < args.size()) {
-        const std::string argument = args[argumentIndex++];
+        std::string const& argument = args[argumentIndex++];
         if (argument == "STRING") {
           sortCompare = cmStringSorter::Compare::STRING;
         } else if (argument == "FILE_BASENAME") {
@@ -1235,7 +1235,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
         return false;
       }
       if (argumentIndex < args.size()) {
-        const std::string argument = args[argumentIndex++];
+        std::string const& argument = args[argumentIndex++];
         if (argument == "SENSITIVE") {
           sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE;
         } else if (argument == "INSENSITIVE") {
@@ -1259,7 +1259,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
         return false;
       }
       if (argumentIndex < args.size()) {
-        const std::string argument = args[argumentIndex++];
+        std::string const& argument = args[argumentIndex++];
         if (argument == "ASCENDING") {
           sortOrder = cmStringSorter::Order::ASCENDING;
         } else if (argument == "DESCENDING") {
@@ -1346,7 +1346,7 @@ bool HandleSublistCommand(std::vector<std::string> const& args,
 
   using size_type = decltype(varArgsExpanded)::size_type;
 
-  if (start < 0 || size_type(start) >= varArgsExpanded.size()) {
+  if (start < 0 || static_cast<size_type>(start) >= varArgsExpanded.size()) {
     status.SetError(cmStrCat("begin index: ", start, " is out of range 0 - ",
                              varArgsExpanded.size() - 1));
     return false;
@@ -1357,9 +1357,10 @@ bool HandleSublistCommand(std::vector<std::string> const& args,
   }
 
   const size_type end =
-    (length == -1 || size_type(start + length) > varArgsExpanded.size())
+    (length == -1 ||
+     static_cast<size_type>(start + length) > varArgsExpanded.size())
     ? varArgsExpanded.size()
-    : size_type(start + length);
+    : static_cast<size_type>(start + length);
   std::vector<std::string> sublist(varArgsExpanded.begin() + start,
                                    varArgsExpanded.begin() + end);
   status.GetMakefile().AddDefinition(variableName, cmJoin(sublist, ";"));

+ 1 - 2
Source/cmListFileCache.cxx

@@ -36,7 +36,7 @@ struct cmListFileParser
   cmListFile* ListFile;
   cmListFileBacktrace Backtrace;
   cmMessenger* Messenger;
-  const char* FileName;
+  const char* FileName = nullptr;
   cmListFileLexer* Lexer;
   std::string FunctionName;
   long FunctionLine;
@@ -55,7 +55,6 @@ cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
   : ListFile(lf)
   , Backtrace(std::move(lfbt))
   , Messenger(messenger)
-  , FileName(nullptr)
   , Lexer(cmListFileLexer_New())
 {
 }

+ 9 - 3
Source/cmListFileCache.h

@@ -110,16 +110,22 @@ public:
   cm::optional<std::string> DeferId;
 
   cmListFileContext() = default;
-  cmListFileContext(cmListFileContext&& /*other*/) = default;
+  // This move constructor is marked `noexcept` yet `clang-tidy` 14 reports it
+  // as being able to throw an exception. Suppress the warning as there doesn't
+  // seem to be any way for this to happen given the member types.
+  // NOLINTNEXTLINE(bugprone-exception-escape)
+  cmListFileContext(cmListFileContext&& /*other*/) noexcept = default;
   cmListFileContext(const cmListFileContext& /*other*/) = default;
   cmListFileContext& operator=(const cmListFileContext& /*other*/) = default;
 #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
-  cmListFileContext& operator=(cmListFileContext&& /*other*/) = default;
+  cmListFileContext& operator=(cmListFileContext&& /*other*/) noexcept =
+    default;
 #else
   // The move assignment operators for several STL classes did not become
   // noexcept until C++17, which causes some tools to warn about this move
   // assignment operator throwing an exception when it shouldn't.
-  cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete;
+  cmListFileContext& operator=(cmListFileContext&& /*other*/) noexcept =
+    delete;
 #endif
 
   cmListFileContext(std::string name, std::string filePath, long line)

+ 1 - 1
Source/cmLoadCacheCommand.cxx

@@ -106,7 +106,7 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
   }
 
   // Prepare the table of variables to read.
-  std::string const prefix = args[2];
+  std::string const& prefix = args[2];
   std::set<std::string> const variablesToRead(args.begin() + 3, args.end());
 
   // Read the cache file.

+ 5 - 11
Source/cmMakefile.cxx

@@ -478,8 +478,8 @@ public:
 private:
   cmMakefile* Makefile;
   bool NoPolicyScope;
-  bool CheckCMP0011;
-  bool ReportError;
+  bool CheckCMP0011 = false;
+  bool ReportError = true;
   void EnforceCMP0011();
 };
 
@@ -488,8 +488,6 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
                                        bool noPolicyScope)
   : Makefile(mf)
   , NoPolicyScope(noPolicyScope)
-  , CheckCMP0011(false)
-  , ReportError(true)
 {
   this->Makefile->Backtrace = this->Makefile->Backtrace.Push(
     cmListFileContext::FromListFilePath(filenametoread));
@@ -623,7 +621,6 @@ class cmMakefile::ListFileScope
 public:
   ListFileScope(cmMakefile* mf, std::string const& filenametoread)
     : Makefile(mf)
-    , ReportError(true)
   {
     this->Makefile->Backtrace = this->Makefile->Backtrace.Push(
       cmListFileContext::FromListFilePath(filenametoread));
@@ -650,7 +647,7 @@ public:
 
 private:
   cmMakefile* Makefile;
-  bool ReportError;
+  bool ReportError = true;
 };
 
 class cmMakefile::DeferScope
@@ -1536,7 +1533,6 @@ class cmMakefile::BuildsystemFileScope
 public:
   BuildsystemFileScope(cmMakefile* mf)
     : Makefile(mf)
-    , ReportError(true)
   {
     std::string currentStart =
       cmStrCat(this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource(),
@@ -1578,7 +1574,7 @@ private:
   cmGlobalGenerator* GG;
   cmMakefile* CurrentMakefile;
   cmStateSnapshot Snapshot;
-  bool ReportError;
+  bool ReportError = true;
 };
 
 void cmMakefile::Configure()
@@ -4511,7 +4507,7 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) const
   /* Record the setting of every policy.  */
   using PolicyID = cmPolicies::PolicyID;
   for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT;
-       pid = PolicyID(pid + 1)) {
+       pid = static_cast<PolicyID>(pid + 1)) {
     pm.Set(pid, this->GetPolicyStatus(pid));
   }
 }
@@ -4538,7 +4534,6 @@ cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf,
                                              const std::string& fileName,
                                              cmPolicies::PolicyMap const& pm)
   : Makefile(mf)
-  , ReportError(true)
 {
   this->Makefile->PushFunctionScope(fileName, pm);
 }
@@ -4552,7 +4547,6 @@ cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf,
                                        const std::string& fileName,
                                        const cmPolicies::PolicyMap& pm)
   : Makefile(mf)
-  , ReportError(true)
 {
   this->Makefile->PushMacroScope(fileName, pm);
 }

+ 2 - 2
Source/cmMakefile.h

@@ -833,7 +833,7 @@ public:
 
   private:
     cmMakefile* Makefile;
-    bool ReportError;
+    bool ReportError = true;
   };
 
   class MacroPushPop
@@ -850,7 +850,7 @@ public:
 
   private:
     cmMakefile* Makefile;
-    bool ReportError;
+    bool ReportError = true;
   };
 
   void PushFunctionScope(std::string const& fileName,

+ 3 - 1
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -929,7 +929,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
   }
 
   // Compute the list of outputs.
-  std::vector<std::string> outputs(1, targetFullPathReal);
+  std::vector<std::string> outputs;
+  outputs.reserve(3);
+  outputs.push_back(targetFullPathReal);
   if (this->TargetNames.SharedObject != this->TargetNames.Real) {
     outputs.push_back(targetFullPathSO);
   }

+ 2 - 2
Source/cmMakefileProfilingData.cxx

@@ -60,7 +60,7 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
     v["ph"] = "B";
     v["name"] = lff.LowerCaseName();
     v["cat"] = "cmake";
-    v["ts"] = Json::Value::UInt64(
+    v["ts"] = static_cast<Json::Value::UInt64>(
       std::chrono::duration_cast<std::chrono::microseconds>(
         std::chrono::steady_clock::now().time_since_epoch())
         .count());
@@ -98,7 +98,7 @@ void cmMakefileProfilingData::StopEntry()
     cmsys::SystemInformation info;
     Json::Value v;
     v["ph"] = "E";
-    v["ts"] = Json::Value::UInt64(
+    v["ts"] = static_cast<Json::Value::UInt64>(
       std::chrono::duration_cast<std::chrono::microseconds>(
         std::chrono::steady_clock::now().time_since_epoch())
         .count());

+ 2 - 2
Source/cmMathCommand.cxx

@@ -57,10 +57,10 @@ bool HandleExprCommand(std::vector<std::string> const& args,
 
   if (argumentIndex < args.size()) {
     const std::string messageHint = "sub-command EXPR ";
-    const std::string option = args[argumentIndex++];
+    std::string const& option = args[argumentIndex++];
     if (option == "OUTPUT_FORMAT") {
       if (argumentIndex < args.size()) {
-        const std::string argument = args[argumentIndex++];
+        std::string const& argument = args[argumentIndex++];
         if (argument == "DECIMAL") {
           outputFormat = NumericFormat::DECIMAL;
         } else if (argument == "HEXADECIMAL") {

+ 0 - 1
Source/cmOSXBundleGenerator.cxx

@@ -18,7 +18,6 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target)
   : GT(target)
   , Makefile(target->Target->GetMakefile())
   , LocalGenerator(target->GetLocalGenerator())
-  , MacContentFolders(nullptr)
 {
   if (this->MustSkip()) {
     return;

+ 1 - 1
Source/cmOSXBundleGenerator.h

@@ -65,5 +65,5 @@ private:
   cmGeneratorTarget* GT;
   cmMakefile* Makefile;
   cmLocalGenerator* LocalGenerator;
-  std::set<std::string>* MacContentFolders;
+  std::set<std::string>* MacContentFolders = nullptr;
 };

+ 0 - 1
Source/cmOutputConverter.cxx

@@ -29,7 +29,6 @@ bool PathEqOrSubDir(std::string const& a, std::string const& b)
 
 cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot)
   : StateSnapshot(snapshot)
-  , LinkScriptShell(false)
 {
   assert(this->StateSnapshot.IsValid());
   this->ComputeRelativePathTopSource();

+ 1 - 1
Source/cmOutputConverter.h

@@ -138,7 +138,7 @@ private:
   static bool Shell_ArgumentNeedsQuotes(cm::string_view in, int flags);
   static std::string Shell_GetArgument(cm::string_view in, int flags);
 
-  bool LinkScriptShell;
+  bool LinkScriptShell = false;
 
   // The top-most directories for relative path conversion.  Both the
   // source and destination location of a relative path conversion

+ 2 - 2
Source/cmPolicies.cxx

@@ -43,7 +43,7 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
   if (id >= cmPolicies::CMPCOUNT) {
     return false;
   }
-  pid = cmPolicies::PolicyID(id);
+  pid = static_cast<cmPolicies::PolicyID>(id);
   return true;
 }
 
@@ -279,7 +279,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
   // now loop over all the policies and set them as appropriate
   std::vector<cmPolicies::PolicyID> ancientPolicies;
   for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT;
-       pid = PolicyID(pid + 1)) {
+       pid = static_cast<PolicyID>(pid + 1)) {
     if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) {
       if (cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) {
         ancientPolicies.push_back(pid);

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません