diff options
67 files changed, 269 insertions, 104 deletions
diff --git a/.gitlab/ci/docker/cuda9.2/install_deps.sh b/.gitlab/ci/docker/cuda9.2/install_deps.sh index 146f982..0dcb507 100755 --- a/.gitlab/ci/docker/cuda9.2/install_deps.sh +++ b/.gitlab/ci/docker/cuda9.2/install_deps.sh @@ -4,6 +4,12 @@ set -e apt-get update +# Update base packages. +apt-get install -y \ + libgnutls30 \ + libssl1.0.0 \ + openssl + # Install development tools. apt-get install -y \ g++ \ diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 1513c90..948775c 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -209,7 +209,7 @@ ### CUDA builds .cuda9.2: - image: "kitware/cmake:ci-cuda9.2-x86_64-2021-07-01" + image: "kitware/cmake:ci-cuda9.2-x86_64-2021-10-01" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" diff --git a/Help/guide/tutorial/A Basic Starting Point.rst b/Help/guide/tutorial/A Basic Starting Point.rst index 41e8479..cf1ec01 100644 --- a/Help/guide/tutorial/A Basic Starting Point.rst +++ b/Help/guide/tutorial/A Basic Starting Point.rst @@ -24,6 +24,45 @@ Upper, lower, and mixed case commands are supported by CMake. The source code for ``tutorial.cxx`` is provided in the ``Step1`` directory and can be used to compute the square root of a number. +Build and Run +------------- + +That's all that is needed - we can build and run our project now! First, run +the :manual:`cmake <cmake(1)>` executable or the +:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it +with your chosen build tool. + +For example, from the command line we could navigate to the +``Help/guide/tutorial`` directory of the CMake source code tree and create a +build directory: + +.. code-block:: console + + mkdir Step1_build + +Next, navigate to the build directory and run CMake to configure the project +and generate a native build system: + +.. code-block:: console + + cd Step1_build + cmake ../Step1 + +Then call that build system to actually compile/link the project: + +.. code-block:: console + + cmake --build . + +Finally, try to use the newly built ``Tutorial`` with these commands: + +.. code-block:: console + + Tutorial 4294967296 + Tutorial 10 + Tutorial + + Adding a Version Number and Configured Header File -------------------------------------------------- @@ -113,39 +152,24 @@ call to ``add_executable``. :language: cmake :end-before: # configure a header file to pass some of the CMake settings -Build and Test --------------- - -Run the :manual:`cmake <cmake(1)>` executable or the -:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it -with your chosen build tool. - -For example, from the command line we could navigate to the -``Help/guide/tutorial`` directory of the CMake source code tree and create a -build directory: - -.. code-block:: console +Rebuild +------- - mkdir Step1_build - -Next, navigate to the build directory and run CMake to configure the project -and generate a native build system: +Let's build our project again. We already created a build directory and ran +CMake, so we can skip to the build step: .. code-block:: console cd Step1_build - cmake ../Step1 - -Then call that build system to actually compile/link the project: - -.. code-block:: console - cmake --build . -Finally, try to use the newly built ``Tutorial`` with these commands: +Now we can try to use the newly built ``Tutorial`` with same commands as before: .. code-block:: console Tutorial 4294967296 Tutorial 10 Tutorial + +Check that the version number is now reported when running the executable without +any arguments. diff --git a/Help/guide/tutorial/Adding System Introspection.rst b/Help/guide/tutorial/Adding System Introspection.rst index 7210a8d..e149110 100644 --- a/Help/guide/tutorial/Adding System Introspection.rst +++ b/Help/guide/tutorial/Adding System Introspection.rst @@ -14,11 +14,14 @@ these functions using the :module:`CheckSymbolExists` module in the ``m`` library. If ``log`` and ``exp`` are not initially found, require the ``m`` library and try again. +Add the checks for ``log`` and ``exp`` to ``MathFunctions/CMakeLists.txt``, +after the call to :command:`target_include_directories`: + .. literalinclude:: Step6/MathFunctions/CMakeLists.txt :caption: MathFunctions/CMakeLists.txt :name: MathFunctions/CMakeLists.txt-check_symbol_exists :language: cmake - :start-after: # does this system provide the log and exp functions? + :start-after: # to find MathFunctions.h, while we don't. :end-before: # add compile definitions If available, use :command:`target_compile_definitions` to specify diff --git a/Help/guide/tutorial/Complete/CMakeLists.txt b/Help/guide/tutorial/Complete/CMakeLists.txt index 4d8a3ad..ec6ff16 100644 --- a/Help/guide/tutorial/Complete/CMakeLists.txt +++ b/Help/guide/tutorial/Complete/CMakeLists.txt @@ -81,7 +81,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") include(InstallRequiredSystemLibraries) diff --git a/Help/guide/tutorial/Step10/CMakeLists.txt b/Help/guide/tutorial/Step10/CMakeLists.txt index 34ae70c..f4f9e05 100644 --- a/Help/guide/tutorial/Step10/CMakeLists.txt +++ b/Help/guide/tutorial/Step10/CMakeLists.txt @@ -63,7 +63,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") include(InstallRequiredSystemLibraries) diff --git a/Help/guide/tutorial/Step11/CMakeLists.txt b/Help/guide/tutorial/Step11/CMakeLists.txt index 4763951..30580e6 100644 --- a/Help/guide/tutorial/Step11/CMakeLists.txt +++ b/Help/guide/tutorial/Step11/CMakeLists.txt @@ -71,7 +71,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") include(InstallRequiredSystemLibraries) diff --git a/Help/guide/tutorial/Step12/CMakeLists.txt b/Help/guide/tutorial/Step12/CMakeLists.txt index 1b0c826..64ea788 100644 --- a/Help/guide/tutorial/Step12/CMakeLists.txt +++ b/Help/guide/tutorial/Step12/CMakeLists.txt @@ -77,7 +77,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") include(InstallRequiredSystemLibraries) diff --git a/Help/guide/tutorial/Step5/CMakeLists.txt b/Help/guide/tutorial/Step5/CMakeLists.txt index c3b375a..fb10f57 100644 --- a/Help/guide/tutorial/Step5/CMakeLists.txt +++ b/Help/guide/tutorial/Step5/CMakeLists.txt @@ -62,5 +62,5 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Help/guide/tutorial/Step6/CMakeLists.txt b/Help/guide/tutorial/Step6/CMakeLists.txt index c3b375a..fb10f57 100644 --- a/Help/guide/tutorial/Step6/CMakeLists.txt +++ b/Help/guide/tutorial/Step6/CMakeLists.txt @@ -62,5 +62,5 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Help/guide/tutorial/Step7/CMakeLists.txt b/Help/guide/tutorial/Step7/CMakeLists.txt index c3b375a..fb10f57 100644 --- a/Help/guide/tutorial/Step7/CMakeLists.txt +++ b/Help/guide/tutorial/Step7/CMakeLists.txt @@ -62,5 +62,5 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Help/guide/tutorial/Step8/CMakeLists.txt b/Help/guide/tutorial/Step8/CMakeLists.txt index 19b9913..89972fb 100644 --- a/Help/guide/tutorial/Step8/CMakeLists.txt +++ b/Help/guide/tutorial/Step8/CMakeLists.txt @@ -62,7 +62,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") # setup installer diff --git a/Help/guide/tutorial/Step9/CMakeLists.txt b/Help/guide/tutorial/Step9/CMakeLists.txt index d5f1cc8..d67209a 100644 --- a/Help/guide/tutorial/Step9/CMakeLists.txt +++ b/Help/guide/tutorial/Step9/CMakeLists.txt @@ -62,7 +62,7 @@ do_test(Tutorial 9 "9 is 3") do_test(Tutorial 5 "5 is 2.236") do_test(Tutorial 7 "7 is 2.645") do_test(Tutorial 25 "25 is 5") -do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial -25 "-25 is (-nan|nan|0)") do_test(Tutorial 0.0001 "0.0001 is 0.01") include(InstallRequiredSystemLibraries) diff --git a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst index 6bbb870..3a17973 100644 --- a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst @@ -32,4 +32,6 @@ The features known to this version of CMake are: Compiler mode is at least CUDA/C++ 20. ``cuda_std_23`` + .. versionadded:: 3.20 + Compiler mode is at least CUDA/C++ 23. diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index 73c0b34..1a913fb 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -18,6 +18,8 @@ The features known to this version of CMake are listed below. High level meta features indicating C++ standard support ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.8 + The following meta features indicate general support for the associated language standard. It reflects the language support claimed by the compiler, but it does not necessarily imply complete conformance to that standard. @@ -35,9 +37,13 @@ but it does not necessarily imply complete conformance to that standard. Compiler mode is at least C++ 17. ``cxx_std_20`` + .. versionadded:: 3.12 + Compiler mode is at least C++ 20. ``cxx_std_23`` + .. versionadded:: 3.20 + Compiler mode is at least C++ 23. Low level individual compile features diff --git a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst index 2bd0feb..97da697 100644 --- a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst @@ -13,7 +13,12 @@ The features listed here may be used with the :command:`target_compile_features` command. See the :manual:`cmake-compile-features(7)` manual for information on compile features and a list of supported compilers. -The features known to this version of CMake are: +The features known to this version of CMake are listed below. + +High level meta features indicating C standard support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.8 ``c_std_90`` Compiler mode is at least C 90. @@ -25,11 +30,18 @@ The features known to this version of CMake are: Compiler mode is at least C 11. ``c_std_17`` + .. versionadded:: 3.21 + Compiler mode is at least C 17. ``c_std_23`` + .. versionadded:: 3.21 + Compiler mode is at least C 23. +Low level individual compile features +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ``c_function_prototypes`` Function prototypes, as defined in ``ISO/IEC 9899:1990``. diff --git a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst index 4a64e33..c2c2609 100644 --- a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst +++ b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst @@ -5,5 +5,8 @@ Suffixes to append when looking for libraries. This specifies what suffixes to add to library names when the :command:`find_library` command looks for libraries. On Windows systems this -is typically ``.lib`` and ``.dll``, meaning that when trying to find the -``foo`` library it will look for ``foo.dll`` etc. +is typically ``.lib`` and, depending on the compiler, ``.dll.a``, ``.a`` +(e.g. GCC and Clang), so when it tries to find the ``foo`` library, it will +look for ``[<prefix>]foo.lib`` and/or ``[<prefix>]foo[.dll].a``, depending on +the compiler used and the ``<prefix>`` specified in the +:variable:`CMAKE_FIND_LIBRARY_PREFIXES`. diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index dad2750..a72575b 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -35,7 +35,7 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) endif() if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT) - set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>") + set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>") endif() if(CMAKE_ASM_NASM_COMPILER_ID STREQUAL "NASM") diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 342425c..d06315e 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -441,9 +441,10 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") if("${_nvcc_output_line}" MATCHES "^ *nvlink") string(APPEND _nvcc_log " ignoring nvlink line\n") elseif(_nvcc_libraries) - if("${_nvcc_output_line}" MATCHES "(@\"?tmp/a\\.exe\\.res\"?)") + if("${_nvcc_output_line}" MATCHES "(@\"?((tmp/)?a\\.exe\\.res)\"?)") set(_nvcc_link_res_arg "${CMAKE_MATCH_1}") - set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/tmp/a.exe.res") + set(_nvcc_link_res_file "${CMAKE_MATCH_2}") + set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/${_nvcc_link_res_file}") if(EXISTS "${_nvcc_link_res}") file(READ "${_nvcc_link_res}" _nvcc_link_res_content) string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}") diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index fdab9e9..0ca593e 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1572,6 +1572,29 @@ if(_numbers_of_matlab_roots GREATER 0) list(GET _matlab_possible_roots ${_matlab_or_mcr_index} Matlab_Or_MCR) list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING) list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR) + elseif(DEFINED Matlab_FIND_VERSION) + foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3) + list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version) + if(_matlab_root_version VERSION_GREATER_EQUAL Matlab_FIND_VERSION) + set(_list_index ${_matlab_root_index}) + break() + endif() + endforeach() + + if(_list_index LESS 0) + set(_list_index 1) + endif() + + math(EXPR _matlab_or_mcr_index "${_list_index} - 1") + math(EXPR _matlab_root_dir_index "${_list_index} + 1") + list(GET _matlab_possible_roots ${_matlab_or_mcr_index} Matlab_Or_MCR) + list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING) + list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR) + # adding a warning in case of ambiguity + if(_numbers_of_matlab_roots GREATER 3 AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." + " If this is not the desired behavior, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line") + endif() else() list(GET _matlab_possible_roots 0 Matlab_Or_MCR) list(GET _matlab_possible_roots 1 Matlab_VERSION_STRING) diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 9e5726b..4d3cb00 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -8,11 +8,10 @@ configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in # configuration changes. if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake - OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in + IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/Output.cmake.in OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e90a9b5..53584c6 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -746,7 +746,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 1) - elseif(gp_tool MATCHES "objdump$") + elseif(gp_tool MATCHES "objdump(\\.exe)?$") set(gp_cmd_args "-p") set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$") set(gp_regex_error "") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0359ca6..7a69f8d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 21) -set(CMake_VERSION_PATCH 20210928) +set(CMake_VERSION_PATCH 20211004) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index bc6abb5..dfd2b6c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2425,7 +2425,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName, case cmCMakePresetsFile::TestPreset::OutputOptions::VerbosityEnum:: Extra: this->Impl->ExtraVerbose = true; - // intentional fallthrough + CM_FALLTHROUGH; case cmCMakePresetsFile::TestPreset::OutputOptions::VerbosityEnum:: Verbose: this->Impl->Verbose = true; diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 68c56d9..f5a5190 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -44,7 +44,7 @@ public: cmMakefile* GetMakefile() { return this->Makefile; } void SetExecutionStatus(cmExecutionStatus* s); - cmExecutionStatus* GetExecutionStatus() { return this->Status; }; + cmExecutionStatus* GetExecutionStatus() { return this->Status; } /** * This is called by the cmMakefile when the command is first diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index a3e346c..831a81f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1185,6 +1185,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) this->CMP0060WarnItems.insert(item); } } + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_ALWAYS: @@ -1454,8 +1455,10 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, this->Target->GetBacktrace()); } } - case cmPolicies::OLD: + CM_FALLTHROUGH; + case cmPolicies::OLD: // NOLINT(bugprone-branch-clone) // OLD behavior does not warn. + break; case cmPolicies::NEW: // NEW behavior will not get here. break; @@ -1494,6 +1497,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is to add the paths containing libraries with // known full paths as link directories. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 2f29610..ef89c8b 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -359,6 +359,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; issueMessage = true; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::NEW: @@ -366,6 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; messageType = MessageType::FATAL_ERROR; + break; } if (issueMessage) { cmake* cm = this->GlobalGenerator->GetCMakeInstance(); diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 913b532..8e479c5 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -117,7 +117,7 @@ bool looksLikeSpecialVariable(const std::string& var, { \ } #else -# define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base; +# define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base #endif // BEGIN cmConditionEvaluator::cmArgumentList @@ -447,6 +447,7 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( "\" appears in a conditional statement. " + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012); status = MessageType::FATAL_ERROR; + break; } case cmPolicies::NEW: break; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 02d559b..971c86e 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -626,6 +626,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, /* clang-format on */ this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is to do nothing. break; @@ -663,6 +664,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, /* clang-format on */ this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is to do nothing. break; @@ -878,6 +880,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, this->Makefile->IssueMessage( MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0067)); + break; case cmPolicies::NEW: // NEW behavior is to honor the language standard variables. // We already initialized honorStandard to true. diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 352eaf2..63440a3 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -282,6 +282,7 @@ static bool HandlePackage(std::vector<std::string> const& args, // CMP0090 decides both the default and what variable changes it. switch (mf.GetPolicyStatus(cmPolicies::CMP0090)) { case cmPolicies::WARN: + CM_FALLTHROUGH; case cmPolicies::OLD: // Default is to export, but can be disabled. if (mf.IsOn("CMAKE_EXPORT_NO_PACKAGE_REGISTRY")) { diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 9ad8876..e2c54d7 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -396,8 +396,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( CbpUnit& cbpUnit = allFiles[fullPath]; cbpUnit.Targets.push_back(target.get()); } - } - default: // intended fallthrough + } break; + default: break; } } diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 549b08b..9e8ac5c 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -208,7 +208,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( case cmStateEnums::MODULE_LIBRARY: { projectType = "Dynamic Library"; } break; - default: // intended fallthrough + default: break; } @@ -233,8 +233,8 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( otherFiles.insert(fullPath); } } - } - default: // intended fallthrough + } break; + default: break; } return projectType; @@ -556,7 +556,8 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: visualname = "lib" + targetName; - default: // intended fallthrough + break; + default: break; } xml.Attribute("Name", visualname); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4eb632d..d2341c5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -640,8 +640,9 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse, case cmPolicies::NEW: g.RecurseThroughSymlinksOff(); break; - case cmPolicies::OLD: case cmPolicies::WARN: + CM_FALLTHROUGH; + case cmPolicies::OLD: g.RecurseThroughSymlinksOn(); break; } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index bfa007c..ff04bab 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -247,7 +247,7 @@ struct cmFindLibraryHelper cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr); this->DebugSearches.FailedAt(path, regexName); } - }; + } void DebugLibraryFound(std::string const& name, std::string const& path) { @@ -256,7 +256,7 @@ struct cmFindLibraryHelper cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr); this->DebugSearches.FoundAt(path, regexName); } - }; + } }; namespace { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ef1f871..8033ef5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1137,6 +1137,7 @@ bool cmGeneratorTarget::IsInBuildSystem() const if (!this->SourceEntries.empty()) { return true; } + break; case cmStateEnums::UNKNOWN_LIBRARY: break; } @@ -2558,6 +2559,7 @@ public: } break; case cmPolicies::OLD: noMessage = true; + break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: @@ -3267,6 +3269,7 @@ void cmGeneratorTarget::AddExplicitLanguageFlags(std::string& flags, switch (this->GetPolicyStatusCMP0119()) { case cmPolicies::WARN: + CM_FALLTHROUGH; case cmPolicies::OLD: // The OLD behavior is to not add explicit language flags. return; @@ -3565,6 +3568,7 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt, } break; case cmPolicies::OLD: noMessage = true; + break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: @@ -7433,6 +7437,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const cm->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), this->GetBacktrace()); } + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::NEW: { @@ -7670,6 +7675,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( } break; case cmPolicies::OLD: noMessage = true; + break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e9ce962..9906963 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -221,7 +221,7 @@ public: { this->PreviousState = target.SetDeviceLink(true); } - ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); }; + ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); } private: cmGeneratorTarget& Target; diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 9c5a2fc..12c8221 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -62,6 +62,7 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, case cmPolicies::WARN: issueMessage = true; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: @@ -69,6 +70,7 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, case cmPolicies::NEW: issueMessage = true; messageType = MessageType::FATAL_ERROR; + break; } if (issueMessage) { e << "get_target_property() called with non-existent target \"" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 981308e..6dabf63 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -965,6 +965,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( mf->IssueMessage( MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025)); + break; case cmPolicies::NEW: // NEW behavior is to keep AppleClang. break; @@ -1031,6 +1032,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( mf->IssueMessage( MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0089)); + break; case cmPolicies::NEW: // NEW behavior is to keep AppleClang. break; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 5c3198e..3f6f55e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1263,7 +1263,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( break; } } - // FALLTHROUGH + CM_FALLTHROUGH; case cmStateEnums::EXECUTABLE: { outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath( config, cmStateEnums::RuntimeBinaryArtifact, realname))); @@ -1275,7 +1275,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( break; } } - // FALLTHROUGH + CM_FALLTHROUGH; case cmStateEnums::GLOBAL_TARGET: case cmStateEnums::INTERFACE_LIBRARY: case cmStateEnums::UTILITY: { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c3d60b0..f34ef62 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1097,7 +1097,7 @@ std::string GetSourcecodeValueFromFileExtension( } else if (ext == "h") { sourcecode += ".c.h"; } else if (ext == "hxx" || ext == "hpp" || ext == "txx" || ext == "pch" || - ext == "hh") { + ext == "hh" || ext == "inl") { sourcecode += ".cpp.h"; } else if (ext == "png" || ext == "gif" || ext == "jpg") { keepLastKnownFileType = true; @@ -1756,9 +1756,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (sourceFile->GetCustomCommand() && visited.insert(sourceFile).second) { commands.push_back(*sourceFile->GetCustomCommand()); - if (this->XcodeBuildSystem >= BuildSystem::Twelve) { - this->CustomCommandRoots[sourceFile].insert(gtgt); - } } } // create custom commands phase diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index ce1f030..7b0320c 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -120,6 +120,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n"; modal = "should"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index ee77b2c..eaf88f6 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1391,6 +1391,7 @@ bool HandleFilesMode(std::vector<std::string> const& args, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n"; modal = "should"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: @@ -1398,6 +1399,7 @@ bool HandleFilesMode(std::vector<std::string> const& args, case cmPolicies::NEW: modal = "may"; messageType = MessageType::FATAL_ERROR; + break; } if (modal) { e << "The file\n " << file diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx index 794694e..0a8e065 100644 --- a/Source/cmInstallSubdirectoryGenerator.cxx +++ b/Source/cmInstallSubdirectoryGenerator.cxx @@ -57,6 +57,7 @@ void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os) this->LocalGenerator->GetPolicyStatus(cmPolicies::CMP0082); switch (status) { case cmPolicies::WARN: + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is handled in cmLocalGenerator::GenerateInstallRules() break; diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 2914046..1ec071b 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -62,7 +62,7 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); - break; + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior does not convert break; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index a1aaee3..7d42fc8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -46,7 +46,7 @@ bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf) cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0121), " Invalid list index \"", arg, "\"."); mf.IssueMessage(MessageType::AUTHOR_WARNING, warn); - break; + CM_FALLTHROUGH; } case cmPolicies::OLD: // OLD behavior is to allow compatibility, so just ignore the diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 966cf28..9b6b9abe 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3780,8 +3780,9 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() // variable. switch (this->GetPolicyStatus(cmPolicies::CMP0001)) { case cmPolicies::WARN: - // WARN is just OLD without warning because user code does not - // always affect whether this check is done. + // WARN is just OLD without warning because user code does not + // always affect whether this check is done. + CM_FALLTHROUGH; case cmPolicies::OLD: // Old behavior is to check the variable. break; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a43faa7..d337d3e 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -796,8 +796,9 @@ cmLocalNinjaGenerator::MakeCustomCommandGenerators( bool transformDepfile = false; switch (cc.GetCMP0116Status()) { - case cmPolicies::OLD: case cmPolicies::WARN: + CM_FALLTHROUGH; + case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 14dd0ba..78aa7f9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -299,7 +299,7 @@ private: cmGeneratorTarget const* target) { return this->CommandsVisited[target]; - }; + } std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>> CommandsVisited; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1744534..83984f7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -818,6 +818,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const // version. this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, msg.str(), this->Backtrace); + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is to use policy version 2.4 set in // cmListFileCache. @@ -829,7 +830,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, msg.str(), this->Backtrace); cmSystemTools::SetFatalErrorOccured(); - return; + break; } } } @@ -1001,6 +1002,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget( case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0040) << "\n"; issueMessage = true; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::NEW: @@ -1008,6 +1010,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget( case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; messageType = MessageType::FATAL_ERROR; + break; } if (issueMessage) { @@ -1751,6 +1754,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); /* clang-format on */ this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior does not warn. break; @@ -1761,6 +1765,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) case cmPolicies::NEW: // NEW behavior prints the error. this->IssueMessage(MessageType::FATAL_ERROR, e.str()); + break; } return; } @@ -2781,6 +2786,7 @@ MessageType cmMakefile::ExpandVariablesInStringOld( case cmPolicies::REQUIRED_ALWAYS: error << "\n" << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010); + break; case cmPolicies::NEW: // NEW behavior is to report the error. break; @@ -3078,8 +3084,8 @@ MessageType cmMakefile::ExpandVariablesInStringNew( break; } } - // Failed to find a valid @ expansion; treat it as literal. - /* FALLTHROUGH */ + // Failed to find a valid @ expansion; treat it as literal. + CM_FALLTHROUGH; default: { if (!openstack.empty() && !(isalnum(inc) || inc == '_' || inc == '/' || inc == '.' || @@ -3976,11 +3982,10 @@ cmValue cmMakefile::GetProperty(const std::string& prop) const if (prop == "TESTS") { std::vector<std::string> keys; // get list of keys - std::transform(this->Tests.begin(), this->Tests.end(), - std::back_inserter(keys), - [](decltype(this->Tests)::value_type const& pair) { - return pair.first; - }); + const auto* t = this; + std::transform( + t->Tests.begin(), t->Tests.end(), std::back_inserter(keys), + [](decltype(t->Tests)::value_type const& pair) { return pair.first; }); output = cmJoin(keys, ";"); return cmValue(output); } @@ -4505,7 +4510,8 @@ bool cmMakefile::IgnoreErrorsCMP0061() const bool ignoreErrors = true; switch (this->GetPolicyStatus(cmPolicies::CMP0061)) { case cmPolicies::WARN: - // No warning for this policy! + // No warning for this policy! + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx index 86188db..337f78b 100644 --- a/Source/cmMakefileProfilingData.cxx +++ b/Source/cmMakefileProfilingData.cxx @@ -29,7 +29,7 @@ cmMakefileProfilingData::cmMakefileProfilingData( } this->ProfileStream << "["; -}; +} cmMakefileProfilingData::~cmMakefileProfilingData() noexcept { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0cbc741..8edadd3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -63,6 +63,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) } switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) { case cmPolicies::WARN: + CM_FALLTHROUGH; case cmPolicies::OLD: this->CMP0113New = false; break; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 2c4a774..ec54fc5 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -34,7 +34,7 @@ bool cmOptionCommand(std::vector<std::string> const& args, switch (policyStatus) { case cmPolicies::WARN: checkAndWarn = (existsBeforeSet != nullptr); - break; + CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior does not warn. break; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index bda2fe5..2b785e1 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -19,7 +19,7 @@ bool PathEqOrSubDir(std::string const& a, std::string const& b) { return (cmSystemTools::ComparePath(a, b) || cmSystemTools::IsSubDirectory(a, b)); -}; +} } cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot) diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index afcb4a2..3de5c1a 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -49,7 +49,7 @@ public: std::vector<std::unique_ptr<cmLocalGenerator>> const& localGenerators); ~cmQtAutoGenGlobalInitializer(); - Keywords const& kw() const { return this->Keywords_; }; + Keywords const& kw() const { return this->Keywords_; } bool generate(); diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index e76817b..603c537 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -95,7 +95,9 @@ public: GenVarsT(GenT gen) : Gen(gen) - , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)){}; + , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)) + { + } }; /** @param mocExecutable The file path to the moc executable. Will be used as @@ -209,7 +211,9 @@ private: struct MocT : public GenVarsT { MocT() - : GenVarsT(GenT::MOC){}; + : GenVarsT(GenT::MOC) + { + } bool RelaxedMode = false; bool PathPrefix = false; @@ -237,7 +241,9 @@ private: using UiFileT = std::pair<std::string, std::vector<std::string>>; UicT() - : GenVarsT(GenT::UIC){}; + : GenVarsT(GenT::UIC) + { + } std::set<std::string> SkipUi; std::vector<std::string> UiFilesNoOptions; @@ -252,7 +258,9 @@ private: struct RccT : public GenVarsT { RccT() - : GenVarsT(GenT::RCC){}; + : GenVarsT(GenT::RCC) + { + } bool GlobalTarget = false; std::vector<Qrc> Qrcs; diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 2753fd5..056056c 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -310,7 +310,7 @@ public: cmQtAutoMocUicT* Gen() const { return static_cast<cmQtAutoMocUicT*>(this->UserData()); - }; + } // -- Accessors. Only valid during Process() call! Logger const& Log() const { return this->Gen()->Log(); } @@ -346,7 +346,7 @@ public: : JobT(true) { } - void Process() override{}; + void Process() override {} }; /** Generate moc_predefs.h. */ diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7fbc8f8..e79949d 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -453,7 +453,7 @@ void cmState::AddDisallowedCommand(std::string const& name, case cmPolicies::WARN: mf.IssueMessage(MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(policy)); - break; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_IF_USED: diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 1cb6193..f44fcf7 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -1054,7 +1054,7 @@ Json::Value& ResolvePath(Json::Value& json, Args path) } } return *search; -}; +} Json::Value ReadJson(const std::string& jsonstr) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 08734b4..97d60cf 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -113,12 +113,14 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>( case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n"; noMessage = false; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: addContent = true; + break; } if (!noMessage) { e << "Target \"" << tgt->GetName() diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index d39824b..e15c941 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -143,6 +143,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n"; modal = "should"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_ALWAYS: @@ -150,6 +151,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, case cmPolicies::NEW: modal = "must"; messageType = MessageType::FATAL_ERROR; + break; } if (modal) { e << "Utility target \"" << target->GetName() << "\" " << modal @@ -395,6 +397,7 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState, case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n"; modal = "should"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_ALWAYS: @@ -402,6 +405,7 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState, case cmPolicies::NEW: modal = "must"; messageType = MessageType::FATAL_ERROR; + break; } if (modal) { diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index b9c9365..9b94142 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -21,6 +21,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; modal = "should"; + CM_FALLTHROUGH; case cmPolicies::OLD: break; case cmPolicies::REQUIRED_ALWAYS: @@ -28,6 +29,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( case cmPolicies::NEW: modal = "may"; messageType = MessageType::FATAL_ERROR; + break; } if (modal) { diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index 8c5ad59..027d690 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -23,7 +23,7 @@ #else -# define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base; +# define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base #endif diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h index ff25526..4035650 100644 --- a/Source/cmWorkerPool.h +++ b/Source/cmWorkerPool.h @@ -87,7 +87,7 @@ public: * Get the user data. * Only valid during the JobT::Process() call! */ - void* UserData() const { return this->Pool_->UserData(); }; + void* UserData() const { return this->Pool_->UserData(); } /** * Get the worker index. @@ -138,7 +138,7 @@ public: { } //! Does nothing - void Process() override{}; + void Process() override {} }; /** diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index 0607f44..7d21959 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -169,7 +169,7 @@ static bool testAllMoves() allTypes b(std::move(a)); allTypes c = std::move(b); return true; -}; +} static bool testLoopReset() { @@ -192,7 +192,7 @@ static bool testLoopReset() } return true; -}; +} static bool testLoopDestructor() { @@ -217,7 +217,7 @@ static bool testLoopDestructor() } return true; -}; +} int testUVRAII(int, char** const) { diff --git a/Utilities/Scripts/update-third-party.bash b/Utilities/Scripts/update-third-party.bash index 0d0a667..bfe6828 100644 --- a/Utilities/Scripts/update-third-party.bash +++ b/Utilities/Scripts/update-third-party.bash @@ -42,6 +42,22 @@ # For convenience, the function may use the "git_archive" function which # does a standard "git archive" extraction using the (optional) "paths" # variable to only extract a subset of the source tree. +# +# Dependencies +# +# To update third party packages from git repositories with submodule, +# you will need to install the "git-archive-all" Python package with +# +# pip install git-archive-all +# +# or install it from https://github.com/Kentzo/git-archive-all. +# +# This package installs a script named "git-archive-all" where pip +# installs executables. If you run pip under your user privileges (i.e., +# not using "sudo"), this location may be $HOME/.local/bin. Make sure +# that directory is in your path so that git can find the +# "git-archive-all" script. +# ######################################################################## ######################################################################## @@ -52,11 +68,24 @@ git_archive () { tar -C "$extractdir" -x } +confirm_archive_all_exists () { + which git-archive-all || die "git requires an archive-all command. Please run 'pip install git-archive-all'" +} + +git_archive_all () { + confirm_archive_all_exists + local tmptarball="temp.tar" + git archive-all --prefix="" "$tmptarball" + mkdir -p "$extractdir/$name-reduced" + tar -C "$extractdir/$name-reduced" -xf "$tmptarball" $paths + rm -f "$tmptarball" +} + disable_custom_gitattributes() { pushd "${extractdir}/${name}-reduced" # Git does not allow custom attributes in a subdirectory where we # are about to merge the `.gitattributes` file, so disable them. - sed -i '/^\[attr\]/ {s/^/#/}' .gitattributes + sed -i '/^\[attr\]/ {s/^/#/;}' .gitattributes popd } @@ -71,6 +100,9 @@ warn () { readonly regex_date='20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' readonly basehash_regex="$name $regex_date ([0-9a-f]*)" +readonly toplevel_dir="$( git rev-parse --show-toplevel )" + +cd "$toplevel_dir" ######################################################################## # Sanity checking @@ -95,7 +127,7 @@ if [ ! -d "$(git rev-parse --show-toplevel)/$subtree" ]; then else readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" fi -readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" +readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p;}' | egrep '^[0-9a-f]+$' )" [ -n "$basehash" ] || \ warn "'basehash' is empty; performing initial import" @@ -111,7 +143,7 @@ readonly extractdir="$workdir/extract" trap "rm -rf '$workdir'" EXIT # Get upstream -git clone "$repo" "$upstreamdir" +git clone --recursive "$repo" "$upstreamdir" if [ -n "$basehash" ]; then # Remove old worktrees @@ -120,7 +152,7 @@ if [ -n "$basehash" ]; then git worktree add "$extractdir" "$basehash" # Clear out the working tree pushd "$extractdir" - git ls-files | xargs rm -v + git ls-files -z --recurse-submodules | xargs -0 rm -v find . -type d -empty -delete popd else @@ -132,6 +164,8 @@ fi # Extract the subset of upstream we care about pushd "$upstreamdir" git checkout "$tag" +git submodule sync --recursive +git submodule update --recursive --init readonly upstream_hash="$( git rev-parse HEAD )" readonly upstream_hash_short="$( git rev-parse --short=8 "$upstream_hash" )" readonly upstream_datetime="$( git rev-list "$upstream_hash" --format='%ci' -n 1 | grep -e "^$regex_date" )" diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c index e6d61ee..4245e02 100644 --- a/Utilities/cmlibuv/src/unix/core.c +++ b/Utilities/cmlibuv/src/unix/core.c @@ -72,8 +72,6 @@ extern char** environ; # include <sys/sysctl.h> # include <sys/filio.h> # include <sys/wait.h> -# include <sys/param.h> -# include <sys/cpuset.h> # if defined(__FreeBSD__) # define uv__accept4 accept4 # endif @@ -82,6 +80,11 @@ extern char** environ; # endif #endif +#if defined(__FreeBSD__) +# include <sys/param.h> +# include <sys/cpuset.h> +#endif + #if defined(__MVS__) #include <sys/ioctl.h> #endif diff --git a/Utilities/cmzstd/lib/common/compiler.h b/Utilities/cmzstd/lib/common/compiler.h index 95e9483..1b864ea 100644 --- a/Utilities/cmzstd/lib/common/compiler.h +++ b/Utilities/cmzstd/lib/common/compiler.h @@ -139,7 +139,7 @@ /* vectorization * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ -#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) +#if !defined(__INTEL_COMPILER) && !defined(__clang__) && !defined(__LCC__) && defined(__GNUC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) # else |