summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-24 14:05:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-05-24 14:05:33 (GMT)
commit9eb81b2f9a115c5fc319ac3679042e6c98a24389 (patch)
tree59923e27f207627d1f52ac0512c49454f5ee3787
parentced9a3b0bbc85fbd392b7323b18d00309a444ddc (diff)
parentef6a7921e504a79a35f8a358901824ba3ed15597 (diff)
downloadCMake-9eb81b2f9a115c5fc319ac3679042e6c98a24389.zip
CMake-9eb81b2f9a115c5fc319ac3679042e6c98a24389.tar.gz
CMake-9eb81b2f9a115c5fc319ac3679042e6c98a24389.tar.bz2
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 <kwrobot@kitware.com> Merge-request: !7271
-rw-r--r--.clang-tidy2
-rw-r--r--.gitlab-ci.yml56
-rw-r--r--.gitlab/ci/configure_fedora35_clang_analyzer.cmake1
-rw-r--r--.gitlab/ci/configure_fedora35_tidy.cmake3
-rw-r--r--.gitlab/ci/configure_fedora36_asan.cmake (renamed from .gitlab/ci/configure_fedora35_asan.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora36_clang_analyzer.cmake1
-rw-r--r--.gitlab/ci/configure_fedora36_common.cmake (renamed from .gitlab/ci/configure_fedora35_common.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora36_makefiles.cmake (renamed from .gitlab/ci/configure_fedora35_makefiles.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora36_ninja.cmake (renamed from .gitlab/ci/configure_fedora35_ninja.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora36_ninja_multi.cmake (renamed from .gitlab/ci/configure_fedora35_ninja_multi.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora36_sphinx.cmake (renamed from .gitlab/ci/configure_fedora35_sphinx.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora36_sphinx_package.cmake (renamed from .gitlab/ci/configure_fedora35_sphinx_package.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora36_tidy.cmake3
-rw-r--r--.gitlab/ci/ctest_memcheck_fedora36_asan.lsan.supp (renamed from .gitlab/ci/ctest_memcheck_fedora35_asan.lsan.supp)0
-rwxr-xr-x.gitlab/ci/docker/debian10/install_rvm.sh1
-rw-r--r--.gitlab/ci/docker/fedora36/Dockerfile (renamed from .gitlab/ci/docker/fedora35/Dockerfile)4
-rwxr-xr-x.gitlab/ci/docker/fedora36/install_deps.sh (renamed from .gitlab/ci/docker/fedora35/install_deps.sh)0
-rwxr-xr-x.gitlab/ci/docker/fedora36/install_ispc.sh (renamed from .gitlab/ci/docker/fedora35/install_ispc.sh)0
-rwxr-xr-x.gitlab/ci/docker/fedora36/install_rvm.sh (renamed from .gitlab/ci/docker/fedora35/install_rvm.sh)6
-rw-r--r--.gitlab/ci/env_fedora35_makefiles.cmake2
-rw-r--r--.gitlab/ci/env_fedora36_asan.sh (renamed from .gitlab/ci/env_fedora35_asan.sh)0
-rw-r--r--.gitlab/ci/env_fedora36_clang_analyzer.sh (renamed from .gitlab/ci/env_fedora35_clang_analyzer.sh)0
-rw-r--r--.gitlab/ci/env_fedora36_makefiles.cmake2
-rw-r--r--.gitlab/os-linux.yml58
-rw-r--r--.gitlab/upload.yml4
-rw-r--r--CTestCustom.cmake.in1
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx2
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx3
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx2
-rw-r--r--Source/CTest/cmCTestBZR.cxx17
-rw-r--r--Source/CTest/cmCTestBinPacker.cxx6
-rw-r--r--Source/CTest/cmCTestCVS.cxx7
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGIT.cxx13
-rw-r--r--Source/CTest/cmCTestHG.cxx10
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx3
-rw-r--r--Source/CTest/cmCTestP4.cxx23
-rw-r--r--Source/CTest/cmCTestSVN.cxx12
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx19
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx3
-rw-r--r--Source/CTest/cmCTestVC.cxx2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx4
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx7
-rw-r--r--Source/cmArchiveWrite.cxx1
-rw-r--r--Source/cmArchiveWrite.h2
-rw-r--r--Source/cmCTest.cxx37
-rw-r--r--Source/cmConditionEvaluator.cxx43
-rw-r--r--Source/cmCoreTryCompile.cxx14
-rw-r--r--Source/cmCryptoHash.cxx8
-rw-r--r--Source/cmDependsFortran.cxx2
-rw-r--r--Source/cmELF.cxx3
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmFileAPI.cxx2
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmFileCopier.cxx10
-rw-r--r--Source/cmFileCopier.h23
-rw-r--r--Source/cmFileInstaller.cxx9
-rw-r--r--Source/cmFileInstaller.h14
-rw-r--r--Source/cmForEachCommand.cxx4
-rw-r--r--Source/cmFortranParser.h3
-rw-r--r--Source/cmGeneratedFileStream.cxx3
-rw-r--r--Source/cmGeneratorExpression.cxx5
-rw-r--r--Source/cmGeneratorExpression.h10
-rw-r--r--Source/cmGeneratorExpressionContext.cxx4
-rw-r--r--Source/cmGeneratorExpressionContext.h8
-rw-r--r--Source/cmGeneratorExpressionNode.cxx10
-rw-r--r--Source/cmGeneratorExpressionParser.cxx1
-rw-r--r--Source/cmGeneratorExpressionParser.h2
-rw-r--r--Source/cmGeneratorTarget.cxx19
-rw-r--r--Source/cmGeneratorTarget.h28
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGraphVizWriter.cxx12
-rw-r--r--Source/cmGraphVizWriter.h24
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx1
-rw-r--r--Source/cmInstallDirectoryGenerator.h2
-rw-r--r--Source/cmInstallExportGenerator.cxx1
-rw-r--r--Source/cmInstallExportGenerator.h2
-rw-r--r--Source/cmInstallFilesGenerator.cxx1
-rw-r--r--Source/cmInstallFilesGenerator.h2
-rw-r--r--Source/cmInstallScriptGenerator.cxx1
-rw-r--r--Source/cmInstallScriptGenerator.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx1
-rw-r--r--Source/cmInstallTargetGenerator.h2
-rw-r--r--Source/cmLinkLineComputer.cxx4
-rw-r--r--Source/cmLinkLineComputer.h8
-rw-r--r--Source/cmListCommand.cxx19
-rw-r--r--Source/cmListFileCache.cxx3
-rw-r--r--Source/cmListFileCache.h12
-rw-r--r--Source/cmLoadCacheCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx16
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileProfilingData.cxx4
-rw-r--r--Source/cmMathCommand.cxx4
-rw-r--r--Source/cmOSXBundleGenerator.cxx1
-rw-r--r--Source/cmOSXBundleGenerator.h2
-rw-r--r--Source/cmOutputConverter.cxx1
-rw-r--r--Source/cmOutputConverter.h2
-rw-r--r--Source/cmPolicies.cxx4
-rw-r--r--Source/cmProcessTools.cxx8
-rw-r--r--Source/cmProjectCommand.cxx4
-rw-r--r--Source/cmRST.cxx5
-rw-r--r--Source/cmRST.h10
-rw-r--r--Source/cmScriptGenerator.cxx2
-rw-r--r--Source/cmScriptGenerator.h4
-rw-r--r--Source/cmSystemTools.cxx10
-rw-r--r--Source/cmTargetDepend.h9
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx2
-rw-r--r--Source/cmTest.cxx3
-rw-r--r--Source/cmTest.h2
-rw-r--r--Source/cmTimestamp.cxx2
-rw-r--r--Source/cmTransformDepfile.cxx4
-rw-r--r--Source/cmUuid.cxx23
-rw-r--r--Source/cmXMLWriter.cxx4
-rw-r--r--Source/cmXMLWriter.h8
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmakemain.cxx4
-rw-r--r--Source/cmcmd.cxx6
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx2
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx3
121 files changed, 374 insertions, 445 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 7b8d200..a86f39a 100644
--- a/.clang-tidy
+++ b/.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,\
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 44ea456..2d72170 100644
--- a/.gitlab-ci.yml
+++ b/.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"
diff --git a/.gitlab/ci/configure_fedora35_clang_analyzer.cmake b/.gitlab/ci/configure_fedora35_clang_analyzer.cmake
deleted file mode 100644
index 761a323..0000000
--- a/.gitlab/ci/configure_fedora35_clang_analyzer.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")
diff --git a/.gitlab/ci/configure_fedora35_tidy.cmake b/.gitlab/ci/configure_fedora35_tidy.cmake
deleted file mode 100644
index 752d241..0000000
--- a/.gitlab/ci/configure_fedora35_tidy.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CMake_RUN_CLANG_TIDY ON CACHE BOOL "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora35_common.cmake")
diff --git a/.gitlab/ci/configure_fedora35_asan.cmake b/.gitlab/ci/configure_fedora36_asan.cmake
index 84fefad..51977d9 100644
--- a/.gitlab/ci/configure_fedora35_asan.cmake
+++ b/.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")
diff --git a/.gitlab/ci/configure_fedora36_clang_analyzer.cmake b/.gitlab/ci/configure_fedora36_clang_analyzer.cmake
new file mode 100644
index 0000000..456936b
--- /dev/null
+++ b/.gitlab/ci/configure_fedora36_clang_analyzer.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora36_common.cmake")
diff --git a/.gitlab/ci/configure_fedora35_common.cmake b/.gitlab/ci/configure_fedora36_common.cmake
index 4484e26..4484e26 100644
--- a/.gitlab/ci/configure_fedora35_common.cmake
+++ b/.gitlab/ci/configure_fedora36_common.cmake
diff --git a/.gitlab/ci/configure_fedora35_makefiles.cmake b/.gitlab/ci/configure_fedora36_makefiles.cmake
index 9dc5ca9..9dc5ca9 100644
--- a/.gitlab/ci/configure_fedora35_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora36_makefiles.cmake
diff --git a/.gitlab/ci/configure_fedora35_ninja.cmake b/.gitlab/ci/configure_fedora36_ninja.cmake
index e6143b7..7e33513 100644
--- a/.gitlab/ci/configure_fedora35_ninja.cmake
+++ b/.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")
diff --git a/.gitlab/ci/configure_fedora35_ninja_multi.cmake b/.gitlab/ci/configure_fedora36_ninja_multi.cmake
index efb4b84..efb4b84 100644
--- a/.gitlab/ci/configure_fedora35_ninja_multi.cmake
+++ b/.gitlab/ci/configure_fedora36_ninja_multi.cmake
diff --git a/.gitlab/ci/configure_fedora35_sphinx.cmake b/.gitlab/ci/configure_fedora36_sphinx.cmake
index 90d159b..90d159b 100644
--- a/.gitlab/ci/configure_fedora35_sphinx.cmake
+++ b/.gitlab/ci/configure_fedora36_sphinx.cmake
diff --git a/.gitlab/ci/configure_fedora35_sphinx_package.cmake b/.gitlab/ci/configure_fedora36_sphinx_package.cmake
index e839de8..e839de8 100644
--- a/.gitlab/ci/configure_fedora35_sphinx_package.cmake
+++ b/.gitlab/ci/configure_fedora36_sphinx_package.cmake
diff --git a/.gitlab/ci/configure_fedora36_tidy.cmake b/.gitlab/ci/configure_fedora36_tidy.cmake
new file mode 100644
index 0000000..38414d3
--- /dev/null
+++ b/.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")
diff --git a/.gitlab/ci/ctest_memcheck_fedora35_asan.lsan.supp b/.gitlab/ci/ctest_memcheck_fedora36_asan.lsan.supp
index 8ec1a03..8ec1a03 100644
--- a/.gitlab/ci/ctest_memcheck_fedora35_asan.lsan.supp
+++ b/.gitlab/ci/ctest_memcheck_fedora36_asan.lsan.supp
diff --git a/.gitlab/ci/docker/debian10/install_rvm.sh b/.gitlab/ci/docker/debian10/install_rvm.sh
index 75c5adc..0ebc746 100755
--- a/.gitlab/ci/docker/debian10/install_rvm.sh
+++ b/.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
diff --git a/.gitlab/ci/docker/fedora35/Dockerfile b/.gitlab/ci/docker/fedora36/Dockerfile
index d1614b4..cf6ded9 100644
--- a/.gitlab/ci/docker/fedora35/Dockerfile
+++ b/.gitlab/ci/docker/fedora36/Dockerfile
@@ -1,10 +1,10 @@
-FROM fedora:35 as rvm-build
+FROM fedora:36 as rvm-build
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_rvm.sh /root/install_rvm.sh
RUN sh /root/install_rvm.sh
-FROM fedora:35
+FROM fedora:36
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_deps.sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/fedora35/install_deps.sh b/.gitlab/ci/docker/fedora36/install_deps.sh
index 13c70e6..13c70e6 100755
--- a/.gitlab/ci/docker/fedora35/install_deps.sh
+++ b/.gitlab/ci/docker/fedora36/install_deps.sh
diff --git a/.gitlab/ci/docker/fedora35/install_ispc.sh b/.gitlab/ci/docker/fedora36/install_ispc.sh
index fdc14b5..fdc14b5 100755
--- a/.gitlab/ci/docker/fedora35/install_ispc.sh
+++ b/.gitlab/ci/docker/fedora36/install_ispc.sh
diff --git a/.gitlab/ci/docker/fedora35/install_rvm.sh b/.gitlab/ci/docker/fedora36/install_rvm.sh
index fca5104..0011f87 100755
--- a/.gitlab/ci/docker/fedora35/install_rvm.sh
+++ b/.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
diff --git a/.gitlab/ci/env_fedora35_makefiles.cmake b/.gitlab/ci/env_fedora35_makefiles.cmake
deleted file mode 100644
index aa84e23..0000000
--- a/.gitlab/ci/env_fedora35_makefiles.cmake
+++ /dev/null
@@ -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}")
diff --git a/.gitlab/ci/env_fedora35_asan.sh b/.gitlab/ci/env_fedora36_asan.sh
index e976486..e976486 100644
--- a/.gitlab/ci/env_fedora35_asan.sh
+++ b/.gitlab/ci/env_fedora36_asan.sh
diff --git a/.gitlab/ci/env_fedora35_clang_analyzer.sh b/.gitlab/ci/env_fedora36_clang_analyzer.sh
index d732c0b..d732c0b 100644
--- a/.gitlab/ci/env_fedora35_clang_analyzer.sh
+++ b/.gitlab/ci/env_fedora36_clang_analyzer.sh
diff --git a/.gitlab/ci/env_fedora36_makefiles.cmake b/.gitlab/ci/env_fedora36_makefiles.cmake
new file mode 100644
index 0000000..2bcb6d0
--- /dev/null
+++ b/.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}")
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index f9af14f..a822d94 100644
--- a/.gitlab/os-linux.yml
+++ b/.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:
diff --git a/.gitlab/upload.yml b/.gitlab/upload.yml
index d831c3e..38d40a9 100644
--- a/.gitlab/upload.yml
+++ b/.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
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 093c1d8..49026a3 100644
--- a/CTestCustom.cmake.in
+++ b/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")
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 9ca7a69..9dd8fe3 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/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 +
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index f25d2d2..46fc57f 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/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
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 8e5e637..a3b9434 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/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()
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 0fe4ff4..81a866a 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/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()
diff --git a/Source/CTest/cmCTestBinPacker.cxx b/Source/CTest/cmCTestBinPacker.cxx
index e21b14d..6eb45fa 100644
--- a/Source/CTest/cmCTestBinPacker.cxx
+++ b/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
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 1209e06..87ab762 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/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
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index aef58c5..f7c6a9c 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/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;
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 56f805c..b2fb069 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/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);
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index 5f4581e..97b01ba 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/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) {
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 2d8276a..788845b 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/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]++;
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 50c9c16..0e67c41 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/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);
}
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 4692dbd..4c98fdf 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/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();
}
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index fae5e30..da085a6 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/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();
}
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 696a5ea..248533a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/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;
}
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index d5711c5..609ccba 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/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,
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 8381e86..5a8e40f 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/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);
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 994df78..f79d6fc 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/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());
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index cfde37c..f29983c 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/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
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 260bd20..b9fa3d7 100644
--- a/Source/cmArchiveWrite.h
+++ b/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;
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 710b4d7..9638a72 100644
--- a/Source/cmCTest.cxx
+++ b/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;
}
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 8e479c5..8df4704 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/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;
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index caa413b..1e84a0b 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/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;
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index b331862..ff9ab0f 100644
--- a/Source/cmCryptoHash.cxx
+++ b/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;
}
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index d5e54ae..ac93c90 100644
--- a/Source/cmDependsFortran.cxx
+++ b/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];
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 66f1733..8aea753 100644
--- a/Source/cmELF.cxx
+++ b/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;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index d9d5a4b..ba4b326 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/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 + "/|";
}
}
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index c1df992..7f8374d 100644
--- a/Source/cmFileAPI.cxx
+++ b/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)
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index e4728ac..27ec564 100644
--- a/Source/cmFileCommand.cxx
+++ b/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);
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 63a4274..1667807 100644
--- a/Source/cmFileCopier.cxx
+++ b/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)
{
}
diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h
index ee9872d..1fd2062 100644
--- a/Source/cmFileCopier.h
+++ b/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);
diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx
index 9bfbd13..5cfb2cf 100644
--- a/Source/cmFileInstaller.cxx
+++ b/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
diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h
index 3f6bd45..0b6f15d 100644
--- a/Source/cmFileInstaller.h
+++ b/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;
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index dcb3626..da82675 100644
--- a/Source/cmForEachCommand.cxx
+++ b/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;
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index 70fe537..542b98c 100644
--- a/Source/cmFortranParser.h
+++ b/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
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index a52e66a..b529b8f 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/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);
}
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 840f511..f988e54 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/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);
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 03be782..188993f 100644
--- a/Source/cmGeneratorExpression.h
+++ b/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;
};
diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx
index 42cbe2a..8076887 100644
--- a/Source/cmGeneratorExpressionContext.cxx
+++ b/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)
{
}
diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h
index 22e7463..21e3961 100644
--- a/Source/cmGeneratorExpressionContext.h
+++ b/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;
};
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 26ffd4b..beb623f 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/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(),
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index 794c1a1..bbee4d5 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -15,7 +15,6 @@
cmGeneratorExpressionParser::cmGeneratorExpressionParser(
std::vector<cmGeneratorExpressionToken> tokens)
: Tokens(std::move(tokens))
- , NestingLevel(0)
{
}
diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h
index efaef3e..63273e4 100644
--- a/Source/cmGeneratorExpressionParser.h
+++ b/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;
};
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d852b48..8ed7f10 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/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();
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index b927848..6bce7d2 100644
--- a/Source/cmGeneratorTarget.h
+++ b/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;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 4a25311..943ce1d 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/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;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3831546..4d636e4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/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);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index ab18e2a..2bb438d 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/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)
{
}
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 0912fc8..24dbe52 100644
--- a/Source/cmGraphVizWriter.h
+++ b/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;
};
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 8462b99..d358763 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/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))
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 419fd8c..7deb9ba 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/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;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index f1ac656..8a48aa2 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/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
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index dc07d36..02fe1fa 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/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;
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 378b9fc..18a852b 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/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))
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 2276ab8..53076b3 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/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;
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index bec98b6..a5625fe 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/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) {
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index 2cf6a4b..c3a7058 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -41,5 +41,5 @@ protected:
std::string const Script;
bool const Code;
cmLocalGenerator* LocalGenerator;
- bool AllowGenex;
+ bool AllowGenex = false;
};
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index ae11afc..16c5002 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/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)
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 6173f2c..3fc4b59 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/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;
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 290642b..b1e9e56 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/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)
{
}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index a1dafc4..9fb222c 100644
--- a/Source/cmLinkLineComputer.h
+++ b/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;
};
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 56345df..d412534 100644
--- a/Source/cmListCommand.cxx
+++ b/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, ";"));
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 5133521..4485ac6 100644
--- a/Source/cmListFileCache.cxx
+++ b/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())
{
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index f7c2509..0553989 100644
--- a/Source/cmListFileCache.h
+++ b/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)
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index d49e711..9981c05 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/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.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 91d7ac5..b5df459 100644
--- a/Source/cmMakefile.cxx
+++ b/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);
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c8e1e83..e7b9716 100644
--- a/Source/cmMakefile.h
+++ b/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,
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 66031db..21b91e0 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/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);
}
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index 337f78b..1cd97c9 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/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());
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index df9ebcf..1c0ff13 100644
--- a/Source/cmMathCommand.cxx
+++ b/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") {
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 7eea4b2..674735b 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/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;
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index a3b6f98..c33b087 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/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;
};
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index e62e0cd..6883535 100644
--- a/Source/cmOutputConverter.cxx
+++ b/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();
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index d19bccc..6e1bfe3 100644
--- a/Source/cmOutputConverter.h
+++ b/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
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index e31de1c..03ae44e 100644
--- a/Source/cmPolicies.cxx
+++ b/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);
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index 9ebf5b7..9e7854b 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -21,12 +21,12 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
(p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) {
if (out && p == cmsysProcess_Pipe_STDOUT) {
processOutput.DecodeText(data, length, strdata, 1);
- if (!out->Process(strdata.c_str(), int(strdata.size()))) {
+ if (!out->Process(strdata.c_str(), static_cast<int>(strdata.size()))) {
out = nullptr;
}
} else if (err && p == cmsysProcess_Pipe_STDERR) {
processOutput.DecodeText(data, length, strdata, 2);
- if (!err->Process(strdata.c_str(), int(strdata.size()))) {
+ if (!err->Process(strdata.c_str(), static_cast<int>(strdata.size()))) {
err = nullptr;
}
}
@@ -34,13 +34,13 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
if (out) {
processOutput.DecodeText(std::string(), strdata, 1);
if (!strdata.empty()) {
- out->Process(strdata.c_str(), int(strdata.size()));
+ out->Process(strdata.c_str(), static_cast<int>(strdata.size()));
}
}
if (err) {
processOutput.DecodeText(std::string(), strdata, 2);
if (!strdata.empty()) {
- err->Process(strdata.c_str(), int(strdata.size()));
+ err->Process(strdata.c_str(), static_cast<int>(strdata.size()));
}
}
cmsysProcess_WaitForExit(cp, nullptr);
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 04d99c9..4b65fb9 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -242,9 +242,9 @@ bool cmProjectCommand(std::vector<std::string> const& args,
const int vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
&v[2], &v[3]);
for (auto i = 0u; i < MAX_VERSION_COMPONENTS; ++i) {
- if (int(i) < vc) {
+ if (static_cast<int>(i) < vc) {
std::snprintf(vb[i], maxIntLength, "%u", v[i]);
- version_string += &"."[std::size_t(i == 0)];
+ version_string += &"."[static_cast<std::size_t>(i == 0)];
version_string += vb[i];
version_components[i] = vb[i];
} else {
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 1e4dedd..fa9d4cc 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -19,11 +19,6 @@
cmRST::cmRST(std::ostream& os, std::string docroot)
: OS(os)
, DocRoot(std::move(docroot))
- , IncludeDepth(0)
- , OutputLinePending(false)
- , LastLineEndedInColonColon(false)
- , Markup(MarkupNone)
- , Directive(DirectiveNone)
, CMakeDirective("^.. (cmake:)?("
"command|envvar|genex|variable"
")::[ \t]+([^ \t\n]+)$")
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 156b20a..ea4ef22 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -69,11 +69,11 @@ private:
std::ostream& OS;
std::string DocRoot;
- int IncludeDepth;
- bool OutputLinePending;
- bool LastLineEndedInColonColon;
- MarkupType Markup;
- DirectiveType Directive;
+ int IncludeDepth = 0;
+ bool OutputLinePending = false;
+ bool LastLineEndedInColonColon = false;
+ MarkupType Markup = MarkupNone;
+ DirectiveType Directive = DirectiveNone;
cmsys::RegularExpression CMakeDirective;
cmsys::RegularExpression CMakeModuleDirective;
cmsys::RegularExpression ParsedLiteralDirective;
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 437b938..166ee56 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -12,8 +12,6 @@ cmScriptGenerator::cmScriptGenerator(std::string config_var,
std::vector<std::string> configurations)
: RuntimeConfigVariable(std::move(config_var))
, Configurations(std::move(configurations))
- , ConfigurationTypes(nullptr)
- , ActionsPerConfig(false)
{
}
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 46d794c..3d7b350 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -78,12 +78,12 @@ protected:
// Information used during generation.
std::string ConfigurationName;
- std::vector<std::string> const* ConfigurationTypes;
+ std::vector<std::string> const* ConfigurationTypes = nullptr;
// True if the subclass needs to generate an explicit rule for each
// configuration. False if the subclass only generates one rule for
// all enabled configurations.
- bool ActionsPerConfig;
+ bool ActionsPerConfig = false;
private:
void GenerateScriptActionsOnce(std::ostream& os, Indent indent);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 527175d..512a5fa 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1995,7 +1995,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
--length;
}
if (length > 0) {
- line.append(&out[0], length);
+ line.append(out.data(), length);
}
out.erase(out.begin(), outiter + 1);
return cmsysProcess_Pipe_STDOUT;
@@ -2013,7 +2013,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
--length;
}
if (length > 0) {
- line.append(&err[0], length);
+ line.append(err.data(), length);
}
err.erase(err.begin(), erriter + 1);
return cmsysProcess_Pipe_STDERR;
@@ -2057,12 +2057,12 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
erriter = err.begin() + size;
}
if (!out.empty()) {
- line.append(&out[0], outiter - out.begin());
+ line.append(out.data(), outiter - out.begin());
out.erase(out.begin(), out.end());
return cmsysProcess_Pipe_STDOUT;
}
if (!err.empty()) {
- line.append(&err[0], erriter - err.begin());
+ line.append(err.data(), erriter - err.begin());
err.erase(err.begin(), err.end());
return cmsysProcess_Pipe_STDERR;
}
@@ -3149,7 +3149,7 @@ static cm::optional<bool> RemoveRPathELF(std::string const& file,
}
return false;
}
- if (!f.write(&bytes[0], bytes.size())) {
+ if (!f.write(bytes.data(), bytes.size())) {
if (emsg) {
*emsg = "Error replacing DYNAMIC table header.";
}
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 9027409..4ff5eb4 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -18,17 +18,14 @@ class cmTargetDepend
// The set order depends only on the Target, so we use
// mutable members to achieve a map with set syntax.
- mutable bool Link;
- mutable bool Util;
- mutable bool Cross;
+ mutable bool Link = false;
+ mutable bool Util = false;
+ mutable bool Cross = false;
mutable cmListFileBacktrace Backtrace;
public:
cmTargetDepend(cmGeneratorTarget const* t)
: Target(t)
- , Link(false)
- , Util(false)
- , Cross(false)
{
}
operator cmGeneratorTarget const*() const { return this->Target; }
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index f31501e..b4b4319 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -99,7 +99,7 @@ bool cmTargetIncludeDirectoriesCommand(std::vector<std::string> const& args,
{
return TargetIncludeDirectoriesImpl(status).HandleArguments(
args, "INCLUDE_DIRECTORIES",
- TargetIncludeDirectoriesImpl::ArgumentFlags(
+ static_cast<TargetIncludeDirectoriesImpl::ArgumentFlags>(
TargetIncludeDirectoriesImpl::PROCESS_BEFORE |
TargetIncludeDirectoriesImpl::PROCESS_AFTER |
TargetIncludeDirectoriesImpl::PROCESS_SYSTEM));
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 7c0f9e7..e6ed01b 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -8,8 +8,7 @@
#include "cmValue.h"
cmTest::cmTest(cmMakefile* mf)
- : CommandExpandLists(false)
- , Backtrace(mf->GetBacktrace())
+ : Backtrace(mf->GetBacktrace())
{
this->Makefile = mf;
this->OldStyle = true;
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 85978da..1c14310 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -64,7 +64,7 @@ private:
cmPropertyMap Properties;
std::string Name;
std::vector<std::string> Command;
- bool CommandExpandLists;
+ bool CommandExpandLists = false;
bool OldStyle;
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index e2b6c20..677fdb6 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -50,7 +50,7 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString,
// SOURCE_DATE_EPOCH has only a resolution in the seconds range
microseconds = 0;
}
- if (currentTimeT == time_t(-1)) {
+ if (currentTimeT == static_cast<time_t>(-1)) {
return std::string();
}
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index 81a6507..12c121f 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -89,7 +89,9 @@ void WriteMSBuildAdditionalInputs(cmsys::ofstream& fout,
}
// Write a UTF-8 BOM so MSBuild knows the encoding when reading the file.
- static const char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) };
+ static const char utf8bom[] = { static_cast<char>(0xEF),
+ static_cast<char>(0xBB),
+ static_cast<char>(0xBF) };
fout.write(utf8bom, sizeof(utf8bom));
// Write the format expected by MSBuild CustomBuild AdditionalInputs.
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 2513303..6688668 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -17,10 +17,10 @@ std::string cmUuid::FromMd5(std::vector<unsigned char> const& uuidNamespace,
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
md5.Initialize();
- md5.Append(&hashInput[0], hashInput.size());
+ md5.Append(hashInput.data(), hashInput.size());
std::vector<unsigned char> digest = md5.Finalize();
- return this->FromDigest(&digest[0], 3);
+ return this->FromDigest(digest.data(), 3);
}
std::string cmUuid::FromSha1(std::vector<unsigned char> const& uuidNamespace,
@@ -31,10 +31,10 @@ std::string cmUuid::FromSha1(std::vector<unsigned char> const& uuidNamespace,
cmCryptoHash sha1(cmCryptoHash::AlgoSHA1);
sha1.Initialize();
- sha1.Append(&hashInput[0], hashInput.size());
+ sha1.Append(hashInput.data(), hashInput.size());
std::vector<unsigned char> digest = sha1.Finalize();
- return this->FromDigest(&digest[0], 5);
+ return this->FromDigest(digest.data(), 5);
}
void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
@@ -46,7 +46,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
if (!name.empty()) {
output.resize(output.size() + name.size());
- memcpy(&output[0] + uuidNamespace.size(), name.c_str(), name.size());
+ memcpy(output.data() + uuidNamespace.size(), name.c_str(), name.size());
}
}
@@ -59,7 +59,7 @@ std::string cmUuid::FromDigest(const unsigned char* digest,
memcpy(uuid, digest, 16);
uuid[6] &= 0xF;
- uuid[6] |= byte_t(version << 4);
+ uuid[6] |= static_cast<byte_t>(version << 4);
uuid[8] &= 0x3F;
uuid[8] |= 0x80;
@@ -118,7 +118,8 @@ std::string cmUuid::ByteToHex(unsigned char byte) const
for (int i = 0; i < 2; ++i) {
unsigned char rest = byte % 16;
byte /= 16;
- char c = (rest < 0xA) ? char('0' + rest) : char('a' + (rest - 0xA));
+ char c = (rest < 0xA) ? static_cast<char>('0' + rest)
+ : static_cast<char>('a' + (rest - 0xA));
result.at(1 - i) = c;
}
@@ -143,7 +144,7 @@ bool cmUuid::StringToBinaryImpl(std::string const& input,
return false;
}
- output.push_back(char(c1 << 4 | c2));
+ output.push_back(static_cast<char>(c1 << 4 | c2));
}
return true;
@@ -152,15 +153,15 @@ bool cmUuid::StringToBinaryImpl(std::string const& input,
bool cmUuid::IntFromHexDigit(char input, char& output) const
{
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;
diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx
index 0811bd0..e4ad9b4 100644
--- a/Source/cmXMLWriter.cxx
+++ b/Source/cmXMLWriter.cxx
@@ -10,10 +10,6 @@ cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level)
: Output(output)
, IndentationElement(1, '\t')
, Level(level)
- , Indent(0)
- , ElementOpen(false)
- , BreakAttrib(false)
- , IsContent(false)
{
}
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 6e8eeb7..49fc864 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -124,10 +124,10 @@ private:
std::stack<std::string, std::vector<std::string>> Elements;
std::string IndentationElement;
std::size_t Level;
- std::size_t Indent;
- bool ElementOpen;
- bool BreakAttrib;
- bool IsContent;
+ std::size_t Indent = 0;
+ bool ElementOpen = false;
+ bool BreakAttrib = false;
+ bool IsContent = false;
};
class cmXMLElement; // IWYU pragma: keep
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6d99a3c..d9ae75a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2551,7 +2551,7 @@ void cmake::AddCacheEntry(const std::string& key, cmValue value,
const char* helpString, int type)
{
this->State->AddCacheEntry(key, value, helpString,
- cmStateEnums::CacheEntryType(type));
+ static_cast<cmStateEnums::CacheEntryType>(type));
this->UnwatchUnusedCli(key);
if (key == "CMAKE_WARN_DEPRECATED"_s) {
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 19b922b..97c275e 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -409,7 +409,7 @@ int extract_job_number(std::string const& command,
} else if (numJobs > INT_MAX) {
std::cerr << "The <jobs> value is too large.\n\n";
} else {
- jobs = int(numJobs);
+ jobs = static_cast<int>(numJobs);
}
} else {
std::cerr << "'" << command << "' invalid number '" << jobString
@@ -594,7 +594,7 @@ int do_build(int ac, char const* const* av)
"is too large.\n\n";
dir.clear();
} else {
- jobs = int(numJobs);
+ jobs = static_cast<int>(numJobs);
}
} else {
std::cerr << "'CMAKE_BUILD_PARALLEL_LEVEL' environment variable\n"
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index df740c9..9ab39f1 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -2069,8 +2069,8 @@ class cmVSLink
{
int Type;
bool Verbose;
- bool Incremental;
- bool LinkGeneratesManifest;
+ bool Incremental = false;
+ bool LinkGeneratesManifest = true;
std::vector<std::string> LinkCommand;
std::vector<std::string> UserManifests;
std::string LinkerManifestFile;
@@ -2085,8 +2085,6 @@ public:
cmVSLink(int type, bool verbose)
: Type(type)
, Verbose(verbose)
- , Incremental(false)
- , LinkGeneratesManifest(true)
{
}
bool Parse(std::vector<std::string>::const_iterator argBeg,
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0ebe00e..0585774 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -115,7 +115,7 @@ private:
void Next()
{
- this->C = char(this->Input.get());
+ this->C = static_cast<char>(this->Input.get());
if (this->Input.bad()) {
this->ErrorExit("Unexpected end of file.");
}
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index daf8a2d..5c6c8d8 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -89,7 +89,8 @@ static int doWrite(int argc, char const* const* argv)
return 1;
}
int resourceGroupCount = std::atoi(resourceGroupCountEnv);
- if (resourceGroups.size() != std::size_t(resourceGroupCount)) {
+ if (resourceGroups.size() !=
+ static_cast<std::size_t>(resourceGroupCount)) {
std::cout
<< "CTEST_RESOURCE_GROUP_COUNT does not match expected resource groups"
<< std::endl