diff options
345 files changed, 2268 insertions, 2609 deletions
diff --git a/Auxiliary/vim/indent/cmake.vim b/Auxiliary/vim/indent/cmake.vim index 6063e43..76aff64 100644 --- a/Auxiliary/vim/indent/cmake.vim +++ b/Auxiliary/vim/indent/cmake.vim @@ -14,7 +14,6 @@ if exists("b:did_indent") endif let b:did_indent = 1 -setlocal et setlocal indentexpr=CMakeGetIndent(v:lnum) setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE( diff --git a/Help/generator/CodeBlocks.rst b/Help/generator/CodeBlocks.rst index d03cb0c..06cc746 100644 --- a/Help/generator/CodeBlocks.rst +++ b/Help/generator/CodeBlocks.rst @@ -6,7 +6,11 @@ Generates CodeBlocks project files. Project files for CodeBlocks will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a PROJECT() call. Additionally a hierarchy of makefiles is generated -into the build tree. The appropriate make program can build the +into the build tree. +The :variable:`CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES` variable may +be set to ``ON`` to exclude any files which are located outside of +the project root directory. +The appropriate make program can build the project through the default make target. A "make install" target is also provided. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 52395c9..1b4873d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -121,6 +121,7 @@ Variables that Change Behavior /variable/CMAKE_AUTOMOC_RELAXED_MODE /variable/CMAKE_BACKWARDS_COMPATIBILITY /variable/CMAKE_BUILD_TYPE + /variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES /variable/CMAKE_CODELITE_USE_TARGETS /variable/CMAKE_COLOR_MAKEFILE /variable/CMAKE_CONFIGURATION_TYPES diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 8aece23..6eef6c6 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -69,11 +69,11 @@ Options See `Find-Package Tool Mode`_. ``--graphviz=[file]`` - Generate graphviz of dependencies, see CMakeGraphVizOptions.cmake for more. + Generate graphviz of dependencies, see :module:`CMakeGraphVizOptions` for more. Generate a graphviz input file that will contain all the library and executable dependencies in the project. See the documentation for - CMakeGraphVizOptions.cmake for more details. + :module:`CMakeGraphVizOptions` for more details. ``--system-information [file]`` Dump information about this system. diff --git a/Help/release/dev/codeblocks-exclude-external.rst b/Help/release/dev/codeblocks-exclude-external.rst new file mode 100644 index 0000000..4c758e3 --- /dev/null +++ b/Help/release/dev/codeblocks-exclude-external.rst @@ -0,0 +1,6 @@ +codeblocks-exclude-external +--------------------------- + +* A :variable:`CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES` variable was added + to tell the :generator:`CodeBlocks` extra generator to exclude files + from outside the project root directory from the generated project files. diff --git a/Help/release/dev/findopenmp-components.rst b/Help/release/dev/findopenmp-components.rst new file mode 100644 index 0000000..243abfa --- /dev/null +++ b/Help/release/dev/findopenmp-components.rst @@ -0,0 +1,5 @@ +findopenmp-components +--------------------- + +* The :module:`FindOpenMP` module gained support for + language-specific components. diff --git a/Help/release/dev/get_filename_component-fix-program-split.rst b/Help/release/dev/get_filename_component-fix-program-split.rst new file mode 100644 index 0000000..55c8719 --- /dev/null +++ b/Help/release/dev/get_filename_component-fix-program-split.rst @@ -0,0 +1,9 @@ +get_filename_component-fix-program-split +---------------------------------------- + +* The :command:`get_filename_component` ``PROGRAM`` mode semantics + have been revised to not tolerate unquoted spaces in the path + to the program while also accepting arguments. While technically + incompatible with the old behavior, it is expected that behavior + under typical use cases with properly-quoted command-lines has + not changed. diff --git a/Help/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES.rst b/Help/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES.rst new file mode 100644 index 0000000..80ffce3 --- /dev/null +++ b/Help/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES.rst @@ -0,0 +1,7 @@ +CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES +--------------------------------------- + +Change the way the CodeBlocks generator creates project files. + +If this variable evaluates to ``ON`` the generator excludes from +the project file any files that are located outside the project root. diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index 420e3a9..3976581 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -11,19 +11,19 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # CMake -# can generate graphviz files, showing the dependencies between the +# can generate `graphviz <http://www.graphviz.org/>`_ files, showing the dependencies between the # targets in a project and also external libraries which are linked -# against. When CMake is run with the --graphviz=foo.dot option, it will +# against. When CMake is run with the ``--graphviz=foo.dot`` option, it will # produce: # -# * a foo.dot file showing all dependencies in the project -# * a foo.dot.<target> file for each target, file showing on which other targets the respective target depends -# * a foo.dot.<target>.dependers file, showing which other targets depend on the respective target +# * a ``foo.dot`` file showing all dependencies in the project +# * a ``foo.dot.<target>`` file for each target, file showing on which other targets the respective target depends +# * a ``foo.dot.<target>.dependers`` file, showing which other targets depend on the respective target # # This can result in huge graphs. Using the file -# CMakeGraphVizOptions.cmake the look and content of the generated +# ``CMakeGraphVizOptions.cmake`` the look and content of the generated # graphs can be influenced. This file is searched first in -# ${CMAKE_BINARY_DIR} and then in ${CMAKE_SOURCE_DIR}. If found, it is +# :variable:`CMAKE_BINARY_DIR` and then in :variable:`CMAKE_SOURCE_DIR`. If found, it is # read and the variables set in it are used to adjust options for the # generated graphviz files. # diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 8e9ce7a..4a3edf9 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -16,6 +16,19 @@ # Variables # ^^^^^^^^^ # +# The module exposes the components ``C``, ``CXX``, and ``Fortran``. +# Each of these controls the various languages to search OpenMP support for. +# +# Depending on the enabled components the following variables will be set: +# +# ``OpenMP_FOUND`` +# Variable indicating that OpenMP flags for all requested languages have been found. +# If no components are specified, this is true if OpenMP settings for all enabled languages +# were detected. +# ``OpenMP_VERSION`` +# Minimal version of the OpenMP standard detected among the requested languages, +# or all enabled languages if no components were specified. +# # This module will set the following variables per language in your # project, where ``<lang>`` is one of C, CXX, or Fortran: # @@ -60,16 +73,6 @@ # The specification date is formatted as given in the OpenMP standard: # ``yyyymm`` where ``yyyy`` and ``mm`` represents the year and month of # the OpenMP specification implemented by the ``<lang>`` compiler. -# -# Backward Compatibility -# ^^^^^^^^^^^^^^^^^^^^^^ -# -# For backward compatibility with older versions of FindOpenMP, these -# variables are set, but deprecated:: -# -# OpenMP_FOUND -# -# In new projects, please use the ``OpenMP_<lang>_XXX`` equivalents. cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST @@ -98,8 +101,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_Flang "-fopenmp") set(OMP_FLAG_SunPro "-xopenmp") set(OMP_FLAG_XL "-qsmp=omp") - # Cray compiles with OpenMP automatically - set(OMP_FLAG_Cray " ") + # Cray compiler activate OpenMP with -h omp, which is enabled by default. + set(OMP_FLAG_Cray " " "-h omp") # If we know the correct flags, use those if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) @@ -286,6 +289,8 @@ endfunction() macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG) set(OpenMP_SPEC_DATE_MAP + # Preview versions + "201611=5.0" # OpenMP 5.0 preview 1 # Combined versions, 2.5 onwards "201511=4.5" "201307=4.0" @@ -373,9 +378,15 @@ if(CMAKE_Fortran_COMPILER_LOADED) endif() endif() -set(OPENMP_FOUND TRUE) +if(NOT OpenMP_FIND_COMPONENTS) + set(OpenMP_FINDLIST C CXX Fortran) +else() + set(OpenMP_FINDLIST ${OpenMP_FIND_COMPONENTS}) +endif() -foreach(LANG IN ITEMS C CXX Fortran) +unset(_OpenMP_MIN_VERSION) + +foreach(LANG IN LISTS OpenMP_FINDLIST) if(CMAKE_${LANG}_COMPILER_LOADED) if (NOT OpenMP_${LANG}_SPEC_DATE) _OPENMP_GET_SPEC_DATE("${LANG}" OpenMP_${LANG}_SPEC_DATE_INTERNAL) @@ -406,6 +417,11 @@ foreach(LANG IN ITEMS C CXX Fortran) ) if(OpenMP_${LANG}_FOUND) + if(DEFINED OpenMP_${LANG}_VERSION) + if(NOT _OpenMP_MIN_VERSION OR _OpenMP_MIN_VERSION VERSION_GREATER OpenMP_${LANG}_VERSION) + set(_OpenMP_MIN_VERSION OpenMP_${LANG}_VERSION) + endif() + endif() set(OpenMP_${LANG}_LIBRARIES "") foreach(_OPENMP_IMPLICIT_LIB IN LISTS OpenMP_${LANG}_LIB_NAMES) list(APPEND OpenMP_${LANG}_LIBRARIES "${OpenMP_${_OPENMP_IMPLICIT_LIB}_LIBRARY}") @@ -424,13 +440,23 @@ foreach(LANG IN ITEMS C CXX Fortran) set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "${OpenMP_${LANG}_LIBRARIES}") endif() - else() - set(OPENMP_FOUND FALSE) endif() endif() endforeach() -set(OpenMP_FOUND ${OPENMP_FOUND}) +unset(_OpenMP_REQ_VARS) +foreach(LANG IN ITEMS C CXX Fortran) + if((NOT OpenMP_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST OpenMP_FIND_COMPONENTS) + list(APPEND _OpenMP_REQ_VARS "OpenMP_${LANG}_FOUND") + endif() +endforeach() + +find_package_handle_standard_args(OpenMP + REQUIRED_VARS ${_OpenMP_REQ_VARS} + VERSION_VAR ${_OpenMP_MIN_VERSION} + HANDLE_COMPONENTS) + +set(OPENMP_FOUND ${OpenMP_FOUND}) if(CMAKE_Fortran_COMPILER_LOADED AND OpenMP_Fortran_FOUND) if(NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 7b08bea..67f6bd6 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -322,7 +322,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) endif () unset(_VERSION_HEAD) else () - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () diff --git a/Modules/Platform/Windows-NMcl.cmake b/Modules/Platform/Windows-NMcl.cmake deleted file mode 100644 index 7add0b0..0000000 --- a/Modules/Platform/Windows-NMcl.cmake +++ /dev/null @@ -1,4 +0,0 @@ -# this is for the numega compiler which is really a front -# end for visual studio, but adds memory checking code. - -include(Platform/Windows-cl) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9c1da41..e63e262 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 9) -set(CMake_VERSION_PATCH 20170913) +set(CMake_VERSION_PATCH 20170918) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 9fd14bd..919dd46 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -47,7 +47,7 @@ public: /** * Destruct IFW generator */ - ~cmCPackIFWGenerator() CM_OVERRIDE; + ~cmCPackIFWGenerator() override; protected: // cmCPackGenerator reimplementation @@ -56,18 +56,18 @@ protected: * @brief Initialize generator * @return 0 on failure */ - int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; - const char* GetPackagingInstallPrefix() CM_OVERRIDE; + int InitializeInternal() override; + int PackageFiles() override; + const char* GetPackagingInstallPrefix() override; /** * @brief Target binary extension * @return Executable suffix or disk image format */ - const char* GetOutputExtension() CM_OVERRIDE; + const char* GetOutputExtension() override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) CM_OVERRIDE; + const std::string& componentName) override; /** * @brief Get Component @@ -79,7 +79,7 @@ protected: * @return Pointer to component */ cmCPackComponent* GetComponent(const std::string& projectName, - const std::string& componentName) CM_OVERRIDE; + const std::string& componentName) override; /** * @brief Get group of component @@ -91,12 +91,12 @@ protected: * @return Pointer to component group */ cmCPackComponentGroup* GetComponentGroup( - const std::string& projectName, const std::string& groupName) CM_OVERRIDE; + const std::string& projectName, const std::string& groupName) override; - enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const - CM_OVERRIDE; - bool SupportsAbsoluteDestination() const CM_OVERRIDE; - bool SupportsComponentInstallation() const CM_OVERRIDE; + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() + const override; + bool SupportsAbsoluteDestination() const override; + bool SupportsComponentInstallation() const override; protected: // Methods diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 288e924..e5c19bb 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -262,7 +262,7 @@ public: std::string path, basePath; protected: - void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE + void StartElement(const std::string& name, const char** /*atts*/) override { this->file = name == "file"; if (file) { @@ -270,7 +270,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { if (this->file) { std::string content(data, data + length); @@ -284,7 +284,7 @@ protected: } } - void EndElement(const std::string& /*name*/) CM_OVERRIDE {} + void EndElement(const std::string& /*name*/) override {} }; void cmCPackIFWInstaller::GenerateInstallerFile() diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index b115db0..990ee74 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -128,7 +128,7 @@ public: bool patched; protected: - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { this->xout.StartElement(name); this->StartFragment(atts); @@ -143,7 +143,7 @@ protected: } } - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "Updates" && !this->patched) { this->repository->WriteRepositoryUpdates(this->xout); @@ -159,7 +159,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { std::string content(data, data + length); if (content == "" || content == " " || content == " " || diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index 31c02a4..8af4c4a 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -20,10 +20,10 @@ public: * Construct generator */ cmCPack7zGenerator(); - ~cmCPack7zGenerator() CM_OVERRIDE; + ~cmCPack7zGenerator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".7z"; } + const char* GetOutputExtension() override { return ".7z"; } }; #endif diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 72ba1b2..9983854 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -28,11 +28,11 @@ public: * Construct generator */ cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format); - ~cmCPackArchiveGenerator() CM_OVERRIDE; + ~cmCPackArchiveGenerator() override; // Used to add a header to the archive virtual int GenerateHeader(std::ostream* os); // component support - bool SupportsComponentInstallation() const CM_OVERRIDE; + bool SupportsComponentInstallation() const override; private: // get archive component filename @@ -40,7 +40,7 @@ private: bool isGroupName); protected: - int InitializeInternal() CM_OVERRIDE; + int InitializeInternal() override; /** * Add the files belonging to the specified component * to the provided (already opened) archive. @@ -56,7 +56,7 @@ protected: * method will call either PackageComponents or * PackageComponentsAllInOne. */ - int PackageFiles() CM_OVERRIDE; + int PackageFiles() override; /** * The method used to package files when component * install is used. This will create one @@ -68,7 +68,7 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(); - const char* GetOutputExtension() CM_OVERRIDE = 0; + const char* GetOutputExtension() override = 0; cmArchiveWrite::Compress Compress; std::string ArchiveFormat; }; diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index e99bf43..27bac3a 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -21,15 +21,15 @@ public: cmCPackTypeMacro(cmCPackBundleGenerator, cmCPackDragNDropGenerator); cmCPackBundleGenerator(); - ~cmCPackBundleGenerator() CM_OVERRIDE; + ~cmCPackBundleGenerator() override; protected: - int InitializeInternal() CM_OVERRIDE; - const char* GetPackagingInstallPrefix() CM_OVERRIDE; + int InitializeInternal() override; + const char* GetPackagingInstallPrefix() override; int ConstructBundle(); int SignBundle(const std::string& src_dir); - int PackageFiles() CM_OVERRIDE; - bool SupportsComponentInstallation() const CM_OVERRIDE; + int PackageFiles() override; + bool SupportsComponentInstallation() const override; std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h index b5a0531..f87a134 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.h +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h @@ -17,7 +17,7 @@ public: * Construct generator */ cmCPackCygwinBinaryGenerator(); - ~cmCPackCygwinBinaryGenerator() CM_OVERRIDE; + ~cmCPackCygwinBinaryGenerator() override; protected: virtual int InitializeInternal(); diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h index d19f87c..a909b15 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.h +++ b/Source/CPack/cmCPackCygwinSourceGenerator.h @@ -17,7 +17,7 @@ public: * Construct generator */ cmCPackCygwinSourceGenerator(); - ~cmCPackCygwinSourceGenerator() CM_OVERRIDE; + ~cmCPackCygwinSourceGenerator() override; protected: const char* GetPackagingInstallPrefix(); diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index 21fc3be..b4f0c79 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -23,7 +23,7 @@ public: * Construct generator */ cmCPackDebGenerator(); - ~cmCPackDebGenerator() CM_OVERRIDE; + ~cmCPackDebGenerator() override; static bool CanGenerate() { @@ -40,7 +40,7 @@ public: } protected: - int InitializeInternal() CM_OVERRIDE; + int InitializeInternal() override; /** * This method factors out the work done in component packaging case. */ @@ -57,11 +57,11 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(const std::string& compInstDirName); - int PackageFiles() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".deb"; } - bool SupportsComponentInstallation() const CM_OVERRIDE; + int PackageFiles() override; + const char* GetOutputExtension() override { return ".deb"; } + bool SupportsComponentInstallation() const override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) CM_OVERRIDE; + const std::string& componentName) override; private: int createDeb(); diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 4606c3c..8565c68 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -23,20 +23,20 @@ public: cmCPackTypeMacro(cmCPackDragNDropGenerator, cmCPackGenerator); cmCPackDragNDropGenerator(); - ~cmCPackDragNDropGenerator() CM_OVERRIDE; + ~cmCPackDragNDropGenerator() override; protected: - int InitializeInternal() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; - bool SupportsComponentInstallation() const CM_OVERRIDE; + int InitializeInternal() override; + const char* GetOutputExtension() override; + int PackageFiles() override; + bool SupportsComponentInstallation() const override; bool CopyFile(std::ostringstream& source, std::ostringstream& target); bool CreateEmptyFile(std::ostringstream& target, size_t size); bool RunCommand(std::ostringstream& command, std::string* output = 0); std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) CM_OVERRIDE; + const std::string& componentName) override; int CreateDMG(const std::string& src_dir, const std::string& output_file); diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index ae17b79..91ae1a2 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -122,7 +122,7 @@ public: { } - void write_value(cmGeneratedFileStream& s) const CM_OVERRIDE + void write_value(cmGeneratedFileStream& s) const override { s << EscapeQuotes(value); } @@ -154,7 +154,7 @@ public: return *this; } - void write_value(cmGeneratedFileStream& s) const CM_OVERRIDE + void write_value(cmGeneratedFileStream& s) const override { bool with_comma = false; @@ -179,7 +179,7 @@ public: { } - void write_value(cmGeneratedFileStream& s) const CM_OVERRIDE + void write_value(cmGeneratedFileStream& s) const override { s << "{\n"; for (VList::const_iterator it = value.begin(); it != value.end(); ++it) { diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h index 230f728..99d2e24 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.h +++ b/Source/CPack/cmCPackFreeBSDGenerator.h @@ -22,13 +22,13 @@ public: * Construct generator */ cmCPackFreeBSDGenerator(); - ~cmCPackFreeBSDGenerator() CM_OVERRIDE; + ~cmCPackFreeBSDGenerator() override; - int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; + int InitializeInternal() override; + int PackageFiles() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".txz"; } + const char* GetOutputExtension() override { return ".txz"; } std::string var_lookup(const char* var_name); void write_manifest_fields(cmGeneratedFileStream&); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 194d4e5..4e3a6e0 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -299,7 +299,7 @@ private: #define cmCPackTypeMacro(klass, superclass) \ typedef superclass Superclass; \ - const char* GetNameOfClass() CM_OVERRIDE { return #klass; } \ + const char* GetNameOfClass() override { return #klass; } \ static cmCPackGenerator* CreateGenerator() { return new klass; } \ class cmCPackTypeMacro_UseTrailingSemicolon diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index bdd1955..fc9ad9a 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -34,22 +34,22 @@ public: * Construct generator */ cmCPackNSISGenerator(bool nsis64 = false); - ~cmCPackNSISGenerator() CM_OVERRIDE; + ~cmCPackNSISGenerator() override; protected: - int InitializeInternal() CM_OVERRIDE; + int InitializeInternal() override; void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr); - int PackageFiles() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".exe"; } - const char* GetOutputPostfix() CM_OVERRIDE { return "win32"; } + int PackageFiles() override; + const char* GetOutputExtension() override { return ".exe"; } + const char* GetOutputPostfix() override { return "win32"; } bool GetListOfSubdirectories(const char* dir, std::vector<std::string>& dirs); - enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const - CM_OVERRIDE; - bool SupportsAbsoluteDestination() const CM_OVERRIDE; - bool SupportsComponentInstallation() const CM_OVERRIDE; + enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() + const override; + bool SupportsAbsoluteDestination() const override; + bool SupportsComponentInstallation() const override; /// Produce a string that contains the NSIS code to describe a /// particular component. Any added macros will be emitted via diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 0a1f686..a6461c8 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -23,13 +23,13 @@ public: * Construct generator */ cmCPackOSXX11Generator(); - ~cmCPackOSXX11Generator() CM_OVERRIDE; + ~cmCPackOSXX11Generator() override; protected: - virtual int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; - const char* GetPackagingInstallPrefix() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".dmg"; } + virtual int InitializeInternal() override; + int PackageFiles() override; + const char* GetPackagingInstallPrefix() override; + const char* GetOutputExtension() override { return ".dmg"; } // bool CopyCreateResourceFile(const std::string& name, // const std::string& dir); diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index aef795f..69286ff 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -27,13 +27,13 @@ public: * Construct generator */ cmCPackPKGGenerator(); - ~cmCPackPKGGenerator() CM_OVERRIDE; + ~cmCPackPKGGenerator() override; - bool SupportsComponentInstallation() const CM_OVERRIDE; + bool SupportsComponentInstallation() const override; protected: - int InitializeInternal() CM_OVERRIDE; - const char* GetOutputPostfix() CM_OVERRIDE { return "darwin"; } + int InitializeInternal() override; + const char* GetOutputPostfix() override { return "darwin"; } // Copies or creates the resource file with the given name to the // package or package staging directory dirName. The variable diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index a2f58ff..0575587 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -25,13 +25,13 @@ public: * Construct generator */ cmCPackPackageMakerGenerator(); - ~cmCPackPackageMakerGenerator() CM_OVERRIDE; - bool SupportsComponentInstallation() const CM_OVERRIDE; + ~cmCPackPackageMakerGenerator() override; + bool SupportsComponentInstallation() const override; protected: - int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".dmg"; } + int InitializeInternal() override; + int PackageFiles() override; + const char* GetOutputExtension() override { return ".dmg"; } // Run PackageMaker with the given command line, which will (if // successful) produce the given package file. Returns true if diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h index 984dcaa..015fe4a 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.h +++ b/Source/CPack/cmCPackProductBuildGenerator.h @@ -25,12 +25,12 @@ public: * Construct generator */ cmCPackProductBuildGenerator(); - ~cmCPackProductBuildGenerator() CM_OVERRIDE; + ~cmCPackProductBuildGenerator() override; protected: - int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".pkg"; } + int InitializeInternal() override; + int PackageFiles() override; + const char* GetOutputExtension() override { return ".pkg"; } // Run ProductBuild with the given command line, which will (if // successful) produce the given package file. Returns true if diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index bfba289..27d3b63 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -26,7 +26,7 @@ public: * Construct generator */ cmCPackRPMGenerator(); - ~cmCPackRPMGenerator() CM_OVERRIDE; + ~cmCPackRPMGenerator() override; static bool CanGenerate() { @@ -43,8 +43,8 @@ public: } protected: - int InitializeInternal() CM_OVERRIDE; - int PackageFiles() CM_OVERRIDE; + int InitializeInternal() override; + int PackageFiles() override; /** * This method factors out the work done in component packaging case. */ @@ -61,10 +61,10 @@ protected: * components will be put in a single installer. */ int PackageComponentsAllInOne(const std::string& compInstDirName); - const char* GetOutputExtension() CM_OVERRIDE { return ".rpm"; } - bool SupportsComponentInstallation() const CM_OVERRIDE; + const char* GetOutputExtension() override { return ".rpm"; } + bool SupportsComponentInstallation() const override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) CM_OVERRIDE; + const std::string& componentName) override; void AddGeneratedPackageNames(); }; diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 72f525c..9cf184b 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -23,13 +23,13 @@ public: * Construct generator */ cmCPackSTGZGenerator(); - ~cmCPackSTGZGenerator() CM_OVERRIDE; + ~cmCPackSTGZGenerator() override; protected: - int PackageFiles() CM_OVERRIDE; - int InitializeInternal() CM_OVERRIDE; - int GenerateHeader(std::ostream* os) CM_OVERRIDE; - const char* GetOutputExtension() CM_OVERRIDE { return ".sh"; } + int PackageFiles() override; + int InitializeInternal() override; + int GenerateHeader(std::ostream* os) override; + const char* GetOutputExtension() override { return ".sh"; } }; #endif diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index e904ab5..7be3d9d 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -20,10 +20,10 @@ public: * Construct generator */ cmCPackTGZGenerator(); - ~cmCPackTGZGenerator() CM_OVERRIDE; + ~cmCPackTGZGenerator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".tar.gz"; } + const char* GetOutputExtension() override { return ".tar.gz"; } }; #endif diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index f38758d..4aa5973 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -20,10 +20,10 @@ public: * Construct generator */ cmCPackTXZGenerator(); - ~cmCPackTXZGenerator() CM_OVERRIDE; + ~cmCPackTXZGenerator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".tar.xz"; } + const char* GetOutputExtension() override { return ".tar.xz"; } }; #endif diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index f3dd953..7975dda 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -19,10 +19,10 @@ public: * Construct generator */ cmCPackTarBZip2Generator(); - ~cmCPackTarBZip2Generator() CM_OVERRIDE; + ~cmCPackTarBZip2Generator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".tar.bz2"; } + const char* GetOutputExtension() override { return ".tar.bz2"; } }; #endif diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 8eedb24..37c7f48 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -19,10 +19,10 @@ public: * Construct generator */ cmCPackTarCompressGenerator(); - ~cmCPackTarCompressGenerator() CM_OVERRIDE; + ~cmCPackTarCompressGenerator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".tar.Z"; } + const char* GetOutputExtension() override { return ".tar.Z"; } }; #endif diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 2f81c65..58ec79e 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -20,10 +20,10 @@ public: * Construct generator */ cmCPackZIPGenerator(); - ~cmCPackZIPGenerator() CM_OVERRIDE; + ~cmCPackZIPGenerator() override; protected: - const char* GetOutputExtension() CM_OVERRIDE { return ".zip"; } + const char* GetOutputExtension() override { return ".zip"; } }; #endif diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 4c9c5ca..861c2b0 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -98,7 +98,7 @@ private: bool CheckOutFound; cmsys::RegularExpression RegexCheckOut; cmsys::RegularExpression RegexParent; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexCheckOut.find(this->Line)) { this->BZR->URL = this->RegexCheckOut.match(1); @@ -123,7 +123,7 @@ public: private: std::string& Rev; cmsys::RegularExpression RegexRevno; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexRevno.find(this->Line)) { this->Rev = this->RegexRevno.match(1); @@ -182,9 +182,9 @@ public: { this->InitializeParser(); } - ~LogParser() CM_OVERRIDE { this->CleanupParser(); } + ~LogParser() override { this->CleanupParser(); } - int InitializeParser() CM_OVERRIDE + int InitializeParser() override { int res = cmXMLParser::InitializeParser(); if (res) { @@ -207,14 +207,14 @@ private: cmsys::RegularExpression EmailRegex; - bool ProcessChunk(const char* data, int length) CM_OVERRIDE + bool ProcessChunk(const char* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE + void StartElement(const std::string& name, const char** /*atts*/) override { this->CData.clear(); if (name == "log") { @@ -239,12 +239,12 @@ private: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { this->CData.insert(this->CData.end(), data, data + length); } - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); @@ -274,7 +274,7 @@ private: this->CData.clear(); } - void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) override { this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n"; } @@ -294,7 +294,7 @@ private: cmCTestBZR* BZR; cmsys::RegularExpression RegexUpdate; - bool ProcessChunk(const char* first, int length) CM_OVERRIDE + bool ProcessChunk(const char* first, int length) override { bool last_is_new_line = (*first == '\r' || *first == '\n'); @@ -325,7 +325,7 @@ private: return true; } - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -373,9 +373,8 @@ bool cmCTestBZR::UpdateImpl() bzr_update.push_back(this->CommandLineTool.c_str()); bzr_update.push_back("pull"); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - bzr_update.push_back(ai->c_str()); + for (std::string const& arg : args) { + bzr_update.push_back(arg.c_str()); } bzr_update.push_back(this->URL.c_str()); @@ -432,7 +431,7 @@ public: private: cmCTestBZR* BZR; cmsys::RegularExpression RegexStatus; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h index b313b25..d5c78c7 100644 --- a/Source/CTest/cmCTestBZR.h +++ b/Source/CTest/cmCTestBZR.h @@ -22,20 +22,20 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestBZR(cmCTest* ctest, std::ostream& log); - ~cmCTestBZR() CM_OVERRIDE; + ~cmCTestBZR() override; private: // Implement cmCTestVC internal API. - bool NoteOldRevision() CM_OVERRIDE; - bool NoteNewRevision() CM_OVERRIDE; - bool UpdateImpl() CM_OVERRIDE; + bool NoteOldRevision() override; + bool NoteNewRevision() override; + bool UpdateImpl() override; // URL of repository directory checked out in the working tree. std::string URL; std::string LoadInfo(); - bool LoadModifications() CM_OVERRIDE; - bool LoadRevisions() CM_OVERRIDE; + bool LoadModifications() override; + bool LoadRevisions() override; // Parsing helper classes. class InfoParser; diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx index beee53a..2eed8be 100644 --- a/Source/CTest/cmCTestBatchTestHandler.cxx +++ b/Source/CTest/cmCTestBatchTestHandler.cxx @@ -29,10 +29,9 @@ void cmCTestBatchTestHandler::WriteBatchScript() fout.open(this->Script.c_str()); fout << "#!/bin/sh\n"; - for (TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); - ++i) { - this->WriteSrunArgs(i->first, fout); - this->WriteTestCommand(i->first, fout); + for (auto const& t : this->Tests) { + this->WriteSrunArgs(t.first, fout); + this->WriteTestCommand(t.first, fout); fout << "\n"; } fout.flush(); @@ -80,9 +79,8 @@ void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout) this->TestHandler->GenerateTestCommand(processArgs, test); processArgs.push_back(command); - for (std::vector<std::string>::iterator arg = processArgs.begin(); - arg != processArgs.end(); ++arg) { - fout << *arg << " "; + for (std::string const& arg : processArgs) { + fout << arg << " "; } std::vector<std::string>::iterator i = args.begin(); diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h index 3b58b13..42f87bd 100644 --- a/Source/CTest/cmCTestBatchTestHandler.h +++ b/Source/CTest/cmCTestBatchTestHandler.h @@ -17,8 +17,8 @@ class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler { public: - ~cmCTestBatchTestHandler() CM_OVERRIDE; - void RunTests() CM_OVERRIDE; + ~cmCTestBatchTestHandler() override; + void RunTests() override; protected: void WriteBatchScript(); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index f9ff2d7..aae3c63 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -45,7 +45,6 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, std::string& cmakeOutString, cmake* cm) { - unsigned int k; std::vector<std::string> args; args.push_back(cmSystemTools::GetCMakeCommand()); args.push_back(this->SourceDir); @@ -80,8 +79,8 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, args.push_back(btype); } - for (k = 0; k < this->BuildOptions.size(); ++k) { - args.push_back(this->BuildOptions[k]); + for (std::string const& opt : this->BuildOptions) { + args.push_back(opt); } if (cm->Run(args) != 0) { out << "Error: cmake execution failed\n"; @@ -219,12 +218,10 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } // do the build - std::vector<std::string>::iterator tarIt; if (this->BuildTargets.empty()) { this->BuildTargets.push_back(""); } - for (tarIt = this->BuildTargets.begin(); tarIt != this->BuildTargets.end(); - ++tarIt) { + for (std::string const& tar : this->BuildTargets) { double remainingTime = 0; if (this->Timeout > 0) { remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start; @@ -249,7 +246,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) config = "Debug"; } int retVal = cm.GetGlobalGenerator()->Build( - this->SourceDir, this->BinaryDir, this->BuildProject, *tarIt, output, + this->SourceDir, this->BinaryDir, this->BuildProject, tar, output, this->BuildMakeProgram, config, !this->BuildNoClean, false, false, remainingTime); out << output; @@ -292,8 +289,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) << this->TestCommand << "\n"; out << "tried to find it in these places:\n"; out << fullPath << "\n"; - for (unsigned int i = 0; i < failed.size(); ++i) { - out << failed[i] << "\n"; + for (std::string const& fail : failed) { + out << fail << "\n"; } if (outstring) { *outstring = out.str(); @@ -305,8 +302,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::vector<const char*> testCommand; testCommand.push_back(fullPath.c_str()); - for (size_t k = 0; k < this->TestCommandArgs.size(); ++k) { - testCommand.push_back(this->TestCommandArgs[k].c_str()); + for (std::string const& testCommandArg : this->TestCommandArgs) { + testCommand.push_back(testCommandArg.c_str()); } testCommand.push_back(nullptr); std::string outs; @@ -317,8 +314,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cmSystemTools::ChangeDirectory(this->BuildRunDir); } out << "Running test command: \"" << fullPath << "\""; - for (size_t k = 0; k < this->TestCommandArgs.size(); ++k) { - out << " \"" << this->TestCommandArgs[k] << "\""; + for (std::string const& testCommandArg : this->TestCommandArgs) { + out << " \"" << testCommandArg << "\""; } out << "\n"; diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index a0d3674..f19cb67 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -26,12 +26,12 @@ public: /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; //! Set all the build and test arguments - int ProcessCommandLineArguments(const std::string& currentArg, size_t& idx, - const std::vector<std::string>& allArgs) - CM_OVERRIDE; + int ProcessCommandLineArguments( + const std::string& currentArg, size_t& idx, + const std::vector<std::string>& allArgs) override; /* * Get the output variable @@ -40,7 +40,7 @@ public: cmCTestBuildAndTestHandler(); - void Initialize() CM_OVERRIDE; + void Initialize() override; protected: ///! Run CMake and build a test and then run it as a single test. diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index f03bb2c..77b0549 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -25,12 +25,12 @@ class cmCTestBuildCommand : public cmCTestHandlerCommand { public: cmCTestBuildCommand(); - ~cmCTestBuildCommand() CM_OVERRIDE; + ~cmCTestBuildCommand() override; /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestBuildCommand* ni = new cmCTestBuildCommand; ni->CTest = this->CTest; @@ -41,10 +41,10 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_build"; } + std::string GetName() const override { return "ctest_build"; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; cmGlobalGenerator* GlobalGenerator; @@ -62,7 +62,7 @@ protected: ctb_LAST }; - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; }; #endif diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 3762e13..361b43b 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -350,18 +350,16 @@ int cmCTestBuildHandler::ProcessHandler() this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]); } - // Pre-compile regular expressions objects for all regular expressions - std::vector<std::string>::iterator it; +// Pre-compile regular expressions objects for all regular expressions #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ regexes.clear(); \ cmCTestOptionalLog(this->CTest, DEBUG, \ this << "Add " #regexes << std::endl, this->Quiet); \ - for (it = (strings).begin(); it != (strings).end(); ++it) { \ + for (std::string const& s : (strings)) { \ cmCTestOptionalLog(this->CTest, DEBUG, \ - "Add " #strings ": " << *it << std::endl, \ - this->Quiet); \ - (regexes).push_back(it->c_str()); \ + "Add " #strings ": " << s << std::endl, this->Quiet); \ + (regexes).push_back(s.c_str()); \ } cmCTestBuildHandlerPopulateRegexVector(this->CustomErrorMatches, this->ErrorMatchRegex); @@ -426,27 +424,24 @@ int cmCTestBuildHandler::ProcessHandler() double elapsed_build_time = cmSystemTools::GetTime() - elapsed_time_start; // Cleanups strings in the errors and warnings list. - t_ErrorsAndWarningsVector::iterator evit; if (!this->SimplifySourceDir.empty()) { - for (evit = this->ErrorsAndWarnings.begin(); - evit != this->ErrorsAndWarnings.end(); ++evit) { - cmSystemTools::ReplaceString(evit->Text, this->SimplifySourceDir.c_str(), + for (cmCTestBuildErrorWarning& evit : this->ErrorsAndWarnings) { + cmSystemTools::ReplaceString(evit.Text, this->SimplifySourceDir.c_str(), "/.../"); - cmSystemTools::ReplaceString(evit->PreContext, + cmSystemTools::ReplaceString(evit.PreContext, this->SimplifySourceDir.c_str(), "/.../"); - cmSystemTools::ReplaceString(evit->PostContext, + cmSystemTools::ReplaceString(evit.PostContext, this->SimplifySourceDir.c_str(), "/.../"); } } if (!this->SimplifyBuildDir.empty()) { - for (evit = this->ErrorsAndWarnings.begin(); - evit != this->ErrorsAndWarnings.end(); ++evit) { - cmSystemTools::ReplaceString(evit->Text, this->SimplifyBuildDir.c_str(), + for (cmCTestBuildErrorWarning& evit : this->ErrorsAndWarnings) { + cmSystemTools::ReplaceString(evit.Text, this->SimplifyBuildDir.c_str(), "/.../"); - cmSystemTools::ReplaceString(evit->PreContext, + cmSystemTools::ReplaceString(evit.PreContext, this->SimplifyBuildDir.c_str(), "/.../"); - cmSystemTools::ReplaceString(evit->PostContext, + cmSystemTools::ReplaceString(evit.PostContext, this->SimplifyBuildDir.c_str(), "/.../"); } } @@ -556,9 +551,8 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml) } // Copy the fragments into the final XML file. - for (Fragments::const_iterator fi = fragments.begin(); fi != fragments.end(); - ++fi) { - xml.FragmentFile(fi->c_str()); + for (std::string const& f : fragments) { + xml.FragmentFile(f.c_str()); } } @@ -588,12 +582,11 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) xml.StartElement(cm->Error ? "Error" : "Warning"); xml.Element("BuildLogLine", cm->LogLine); xml.Element("Text", cm->Text); - std::vector<cmCTestCompileErrorWarningRex>::iterator rit; - for (rit = this->ErrorWarningFileLineRegex.begin(); - rit != this->ErrorWarningFileLineRegex.end(); ++rit) { - cmsys::RegularExpression* re = &rit->RegularExpression; + for (cmCTestCompileErrorWarningRex& rit : + this->ErrorWarningFileLineRegex) { + cmsys::RegularExpression* re = &rit.RegularExpression; if (re->find(cm->Text.c_str())) { - cm->SourceFile = re->match(rit->FileIndex); + cm->SourceFile = re->match(rit.FileIndex); // At this point we need to make this->SourceFile relative to // the source root of the project, so cvs links will work cmSystemTools::ConvertToUnixSlashes(cm->SourceFile); @@ -609,7 +602,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) cm->SourceFile = cmSystemTools::CollapseFullPath(cm->SourceFile); cmSystemTools::ReplaceString(cm->SourceFile, srcdir.c_str(), ""); } - cm->LineNumber = atoi(re->match(rit->LineIndex).c_str()); + cm->LineNumber = atoi(re->match(rit.LineIndex).c_str()); break; } } @@ -759,9 +752,8 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers( fname += purpose; fname += ".txt"; cmGeneratedFileStream fout(fname.c_str()); - for (std::vector<std::string>::const_iterator mi = matchers.begin(); - mi != matchers.end(); ++mi) { - fout << *mi << "\n"; + for (std::string const& m : matchers) { + fout << m << "\n"; } } @@ -777,18 +769,19 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, } std::vector<const char*> argv; - for (std::vector<std::string>::const_iterator a = args.begin(); - a != args.end(); ++a) { - argv.push_back(a->c_str()); + for (std::string const& arg : args) { + argv.push_back(arg.c_str()); } argv.push_back(nullptr); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:", this->Quiet); - std::vector<const char*>::iterator ait; - for (ait = argv.begin(); ait != argv.end() && *ait; ++ait) { + for (char const* arg : argv) { + if (!arg) { + break; + } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " \"" << *ait << "\"", this->Quiet); + " \"" << arg << "\"", this->Quiet); } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, this->Quiet); @@ -1007,10 +1000,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, errorwarning.PostContext = ""; // Copy pre-context to report - std::deque<std::string>::iterator pcit; - for (pcit = this->PreContext.begin(); pcit != this->PreContext.end(); - ++pcit) { - errorwarning.PreContext += *pcit + "\n"; + for (std::string const& pc : this->PreContext) { + errorwarning.PreContext += pc + "\n"; } this->PreContext.clear(); @@ -1082,8 +1073,6 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << data << "]" << std::endl, this->Quiet); - std::vector<cmsys::RegularExpression>::iterator it; - int warningLine = 0; int errorLine = 0; @@ -1092,9 +1081,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if (!this->ErrorQuotaReached) { // Errors int wrxCnt = 0; - for (it = this->ErrorMatchRegex.begin(); it != this->ErrorMatchRegex.end(); - ++it) { - if (it->find(data)) { + for (cmsys::RegularExpression& rx : this->ErrorMatchRegex) { + if (rx.find(data)) { errorLine = 1; cmCTestOptionalLog(this->CTest, DEBUG, " Error Line: " << data << " (matches: " @@ -1107,9 +1095,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) } // Error exceptions wrxCnt = 0; - for (it = this->ErrorExceptionRegex.begin(); - it != this->ErrorExceptionRegex.end(); ++it) { - if (it->find(data)) { + for (cmsys::RegularExpression& rx : this->ErrorExceptionRegex) { + if (rx.find(data)) { errorLine = 0; cmCTestOptionalLog(this->CTest, DEBUG, " Not an error Line: " << data << " (matches: " @@ -1124,9 +1111,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if (!this->WarningQuotaReached) { // Warnings int wrxCnt = 0; - for (it = this->WarningMatchRegex.begin(); - it != this->WarningMatchRegex.end(); ++it) { - if (it->find(data)) { + for (cmsys::RegularExpression& rx : this->WarningMatchRegex) { + if (rx.find(data)) { warningLine = 1; cmCTestOptionalLog(this->CTest, DEBUG, " Warning Line: " << data << " (matches: " @@ -1140,9 +1126,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) wrxCnt = 0; // Warning exceptions - for (it = this->WarningExceptionRegex.begin(); - it != this->WarningExceptionRegex.end(); ++it) { - if (it->find(data)) { + for (cmsys::RegularExpression& rx : this->WarningExceptionRegex) { + if (rx.find(data)) { warningLine = 0; cmCTestOptionalLog(this->CTest, DEBUG, " Not a warning Line: " << data << " (matches: " diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index ca11143..6e71ad6 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -31,16 +31,16 @@ public: /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; cmCTestBuildHandler(); - void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; + void PopulateCustomVectors(cmMakefile* mf) override; /** * Initialize handler */ - void Initialize() CM_OVERRIDE; + void Initialize() override; int GetTotalErrors() { return this->TotalErrors; } int GetTotalWarnings() { return this->TotalWarnings; } diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index f2a9a85..5779935 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -46,7 +46,7 @@ private: cmsys::RegularExpression RegexFileRemoved1; cmsys::RegularExpression RegexFileRemoved2; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexFileUpdated.find(this->Line)) { this->DoFile(PathUpdated, this->RegexFileUpdated.match(2)); @@ -92,9 +92,8 @@ bool cmCTestCVS::UpdateImpl() cvs_update.push_back(this->CommandLineTool.c_str()); cvs_update.push_back("-z3"); cvs_update.push_back("update"); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - cvs_update.push_back(ai->c_str()); + for (std::string const& arg : args) { + cvs_update.push_back(arg.c_str()); } cvs_update.push_back(nullptr); @@ -133,7 +132,7 @@ private: SectionType Section; Revision Rev; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->Line == ("=======================================" "======================================")) { @@ -242,12 +241,12 @@ void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, // Load revisions and write an entry for each file in this directory. std::vector<Revision> revisions; - for (Directory::const_iterator fi = dir.begin(); fi != dir.end(); ++fi) { - std::string full = path + slash + fi->first; + for (auto const& fi : dir) { + std::string full = path + slash + fi.first; // Load two real or unknown revisions. revisions.clear(); - if (fi->second != PathUpdated) { + if (fi.second != PathUpdated) { // For local modifications the current rev is unknown and the // prior rev is the latest from cvs. revisions.push_back(this->Unknown); @@ -256,8 +255,8 @@ 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]); - this->WriteXMLEntry(xml, path, fi->first, full, f); + File f(fi.second, &revisions[0], &revisions[1]); + this->WriteXMLEntry(xml, path, fi.first, full, f); } xml.EndElement(); // Directory } @@ -269,10 +268,8 @@ bool cmCTestCVS::WriteXMLUpdates(cmXMLWriter& xml) " " << std::flush); - for (std::map<std::string, Directory>::const_iterator di = - this->Dirs.begin(); - di != this->Dirs.end(); ++di) { - this->WriteXMLDirectory(xml, di->first, di->second); + for (auto const& d : this->Dirs) { + this->WriteXMLDirectory(xml, d.first, d.second); } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index 171460e..77fc3cc 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -25,12 +25,12 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestCVS(cmCTest* ctest, std::ostream& log); - ~cmCTestCVS() CM_OVERRIDE; + ~cmCTestCVS() override; private: // Implement cmCTestVC internal API. - bool UpdateImpl() CM_OVERRIDE; - bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE; + bool UpdateImpl() override; + bool WriteXMLUpdates(cmXMLWriter& xml) override; // Update status for files in each directory. class Directory : public std::map<std::string, PathStatus> diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index faa75d3..c44b866 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -79,11 +79,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += cmSystemTools::GetCMakeCommand(); cmakeConfigureCommand += "\""; - std::vector<std::string>::const_iterator it; - std::string option; - for (it = options.begin(); it != options.end(); ++it) { - option = *it; - + for (std::string const& option : options) { cmakeConfigureCommand += " \""; cmakeConfigureCommand += option; cmakeConfigureCommand += "\""; diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index dfb3a59..0cbcbfa 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestConfigureCommand* ni = new cmCTestConfigureCommand; ni->CTest = this->CTest; @@ -36,10 +36,10 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_configure"; } + std::string GetName() const override { return "ctest_configure"; } protected: - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; enum { diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index 32a6ba7..680401c 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -19,11 +19,11 @@ public: /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; cmCTestConfigureHandler(); - void Initialize() CM_OVERRIDE; + void Initialize() override; }; #endif diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 9ea0223..1ae2d86 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestCoverageCommand* ni = new cmCTestCoverageCommand; ni->CTest = this->CTest; @@ -37,15 +37,15 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_coverage"; } + std::string GetName() const override { return "ctest_coverage"; } typedef cmCTestHandlerCommand Superclass; protected: - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; - bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; - bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentKeyword(std::string const& arg) override; + bool CheckArgumentValue(std::string const& arg) override; enum { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index e3d68c6..5ae4ed5 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -67,10 +67,8 @@ public: bool StartProcess() { std::vector<const char*> args; - for (std::vector<std::string>::iterator i = - this->CommandLineStrings.begin(); - i != this->CommandLineStrings.end(); ++i) { - args.push_back(i->c_str()); + for (std::string const& cl : this->CommandLineStrings) { + args.push_back(cl.c_str()); } args.push_back(nullptr); // null terminate cmsysProcess_SetCommand(this->Process, &*args.begin()); @@ -136,10 +134,9 @@ void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log) cmsys::Glob gl; gl.FindFiles(logGlob); std::vector<std::string> const& files = gl.GetFiles(); - for (std::vector<std::string>::const_iterator fi = files.begin(); - fi != files.end(); ++fi) { - log << "Removing old coverage log: " << *fi << "\n"; - cmSystemTools::RemoveFile(*fi); + for (std::string const& f : files) { + log << "Removing old coverage log: " << f << "\n"; + cmSystemTools::RemoveFile(f); } } @@ -196,10 +193,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, return false; } - std::vector<cmsys::RegularExpression>::iterator sit; - for (sit = this->CustomCoverageExcludeRegex.begin(); - sit != this->CustomCoverageExcludeRegex.end(); ++sit) { - if (sit->find(file)) { + for (cmsys::RegularExpression& rx : this->CustomCoverageExcludeRegex) { + if (rx.find(file)) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file << " is excluded in CTestCustom.ctest" << std::endl; @@ -319,11 +314,9 @@ int cmCTestCoverageHandler::ProcessHandler() // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); - std::vector<std::string>::iterator rexIt; - for (rexIt = this->CustomCoverageExclude.begin(); - rexIt != this->CustomCoverageExclude.end(); ++rexIt) { + for (std::string const& rex : this->CustomCoverageExclude) { this->CustomCoverageExcludeRegex.push_back( - cmsys::RegularExpression(rexIt->c_str())); + cmsys::RegularExpression(rex.c_str())); } if (this->HandleBullseyeCoverage(&cont)) { @@ -414,7 +407,6 @@ int cmCTestCoverageHandler::ProcessHandler() return -1; } this->StartCoverageLogXML(covLogXML); - cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator fileIterator; int cnt = 0; long total_tested = 0; long total_untested = 0; @@ -430,8 +422,7 @@ int cmCTestCoverageHandler::ProcessHandler() std::vector<std::string> errorsWhileAccumulating; file_count = 0; - for (fileIterator = cont.TotalCoverage.begin(); - fileIterator != cont.TotalCoverage.end(); ++fileIterator) { + for (auto const& file : cont.TotalCoverage) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, this->Quiet); file_count++; @@ -443,7 +434,7 @@ int cmCTestCoverageHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } - const std::string fullFileName = fileIterator->first; + const std::string fullFileName = file.first; bool shouldIDoCoverage = this->ShouldIDoCoverage( fullFileName.c_str(), sourceDir.c_str(), binaryDir.c_str()); if (!shouldIDoCoverage) { @@ -478,7 +469,7 @@ int cmCTestCoverageHandler::ProcessHandler() std::string shortFileName = this->CTest->GetShortPathToFile(fullFileName.c_str()); const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov = - fileIterator->second; + file.second; covLogXML.StartElement("File"); covLogXML.Attribute("Name", fileName); covLogXML.Attribute("FullPath", shortFileName); @@ -554,14 +545,13 @@ int cmCTestCoverageHandler::ProcessHandler() } // Handle all the files in the extra coverage globs that have no cov data - for (std::set<std::string>::iterator i = uncovered.begin(); - i != uncovered.end(); ++i) { - std::string fileName = cmSystemTools::GetFilenameName(*i); - std::string fullPath = cont.SourceDir + "/" + *i; + for (std::string const& u : uncovered) { + std::string fileName = cmSystemTools::GetFilenameName(u); + std::string fullPath = cont.SourceDir + "/" + u; covLogXML.StartElement("File"); covLogXML.Attribute("Name", fileName); - covLogXML.Attribute("FullPath", *i); + covLogXML.Attribute("FullPath", u); covLogXML.StartElement("Report"); cmsys::ifstream ifs(fullPath.c_str()); @@ -575,7 +565,7 @@ int cmCTestCoverageHandler::ProcessHandler() int untested = 0; std::string line; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << *i << std::endl, + "Actually performing coverage for: " << u << std::endl, this->Quiet); while (cmSystemTools::GetLineFromStream(ifs, line)) { covLogXML.StartElement("Line"); @@ -591,13 +581,13 @@ int cmCTestCoverageHandler::ProcessHandler() total_untested += untested; covSumXML.StartElement("File"); covSumXML.Attribute("Name", fileName); - covSumXML.Attribute("FullPath", *i); + covSumXML.Attribute("FullPath", u); covSumXML.Attribute("Covered", "true"); covSumXML.Element("LOCTested", 0); covSumXML.Element("LOCUnTested", untested); covSumXML.Element("PercentCoverage", 0); covSumXML.Element("CoverageMetric", 0); - this->WriteXMLLabels(covSumXML, *i); + this->WriteXMLLabels(covSumXML, u); covSumXML.EndElement(); // File } @@ -608,10 +598,8 @@ int cmCTestCoverageHandler::ProcessHandler() cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Error(s) while accumulating results:" << std::endl); - std::vector<std::string>::iterator erIt; - for (erIt = errorsWhileAccumulating.begin(); - erIt != errorsWhileAccumulating.end(); ++erIt) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " " << *erIt << std::endl); + for (std::string const& er : errorsWhileAccumulating) { + cmCTestLog(this->CTest, ERROR_MESSAGE, " " << er << std::endl); } } @@ -668,17 +656,14 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf) this->CustomCoverageExclude); this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", this->ExtraCoverageGlobs); - std::vector<std::string>::iterator it; - for (it = this->CustomCoverageExclude.begin(); - it != this->CustomCoverageExclude.end(); ++it) { + for (std::string const& cce : this->CustomCoverageExclude) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Add coverage exclude: " << *it << std::endl, + " Add coverage exclude: " << cce << std::endl, this->Quiet); } - for (it = this->ExtraCoverageGlobs.begin(); - it != this->ExtraCoverageGlobs.end(); ++it) { + for (std::string const& ecg : this->ExtraCoverageGlobs) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Add coverage glob: " << *it << std::endl, + " Add coverage glob: " << ecg << std::endl, this->Quiet); } } @@ -893,12 +878,12 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage( // Blanket.js output. Check for the "node-jscoverage" // string on the second line std::string line; - for (unsigned int fileEntry = 0; fileEntry < files.size(); fileEntry++) { - cmsys::ifstream in(files[fileEntry].c_str()); + for (std::string const& fileEntry : files) { + cmsys::ifstream in(fileEntry.c_str()); cmSystemTools::GetLineFromStream(in, line); cmSystemTools::GetLineFromStream(in, line); if (line.find("node-jscoverage") != std::string::npos) { - blanketFiles.push_back(files[fileEntry]); + blanketFiles.push_back(fileEntry); } } // Take all files with the node-jscoverage string and parse those @@ -959,7 +944,6 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::vector<std::string> files; this->FindGCovFiles(files); - std::vector<std::string>::iterator it; if (files.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -994,15 +978,15 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // These are binary files that you give as input to gcov so that it will // give us text output we can analyze to summarize coverage. // - for (it = files.begin(); it != files.end(); ++it) { + for (std::string const& f : files) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, this->Quiet); // Call gcov to get coverage data for this *.gcda file: // - std::string fileDir = cmSystemTools::GetFilenamePath(*it); + std::string fileDir = cmSystemTools::GetFilenamePath(f); std::string command = "\"" + gcovCommand + "\" " + gcovExtraFlags + " " + - "-o \"" + fileDir + "\" " + "\"" + *it + "\""; + "-o \"" + fileDir + "\" " + "\"" + f + "\""; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command << std::endl, this->Quiet); @@ -1020,7 +1004,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( *cont->OFS << " Errors: " << errors << std::endl; if (!res) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Problem running coverage on file: " << *it << std::endl); + "Problem running coverage on file: " << f << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << errors << std::endl); cont->Error++; @@ -1028,7 +1012,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } if (retVal != 0) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Coverage command returned: " - << retVal << " while processing: " << *it << std::endl); + << retVal << " while processing: " << f << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } @@ -1042,20 +1026,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage( this->Quiet); std::vector<std::string> lines; - std::vector<std::string>::iterator line; cmSystemTools::Split(output.c_str(), lines); - for (line = lines.begin(); line != lines.end(); ++line) { + for (std::string const& line : lines) { std::string sourceFile; std::string gcovFile; cmCTestOptionalLog(this->CTest, DEBUG, - "Line: [" << *line << "]" << std::endl, this->Quiet); + "Line: [" << line << "]" << std::endl, this->Quiet); - if (line->empty()) { + if (line.empty()) { // Ignore empty line; probably style 2 - } else if (st1re1.find(line->c_str())) { + } else if (st1re1.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 1; } @@ -1068,7 +1051,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( actualSourceFile = ""; sourceFile = st1re1.match(2); - } else if (st1re2.find(line->c_str())) { + } else if (st1re2.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 1; } @@ -1080,7 +1063,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } gcovFile = st1re2.match(1); - } else if (st2re1.find(line->c_str())) { + } else if (st2re1.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1093,7 +1076,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( actualSourceFile = ""; sourceFile = st2re1.match(1); - } else if (st2re2.find(line->c_str())) { + } else if (st2re2.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1103,7 +1086,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cont->Error++; break; } - } else if (st2re3.find(line->c_str())) { + } else if (st2re3.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1115,7 +1098,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } gcovFile = st2re3.match(2); - } else if (st2re4.find(line->c_str())) { + } else if (st2re4.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1130,7 +1113,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "Warning: " << st2re4.match(1) << " had unexpected EOF" << std::endl, this->Quiet); - } else if (st2re5.find(line->c_str())) { + } else if (st2re5.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1144,7 +1127,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestOptionalLog(this->CTest, WARNING, "Warning: Cannot open file: " << st2re5.match(1) << std::endl, this->Quiet); - } else if (st2re6.find(line->c_str())) { + } else if (st2re6.find(line.c_str())) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1162,10 +1145,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } else { // gcov 4.7 can have output lines saying "No executable lines" and // "Removing 'filename.gcov'"... Don't log those as "errors." - if (*line != "No executable lines" && - !cmSystemTools::StringStartsWith(line->c_str(), "Removing ")) { + if (line != "No executable lines" && + !cmSystemTools::StringStartsWith(line.c_str(), "Removing ")) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output line: [" - << *line << "]" << std::endl); + << line << "]" << std::endl); cont->Error++; // abort(); } @@ -1330,7 +1313,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage( "Error while finding LCov files.\n"); return 0; } - std::vector<std::string>::iterator it; if (files.empty()) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -1357,10 +1339,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // In intel compiler we have to call codecov only once in each executable // directory. It collects all *.dyn files to generate .dpi file. - for (it = files.begin(); it != files.end(); ++it) { + for (std::string const& f : files) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, this->Quiet); - std::string fileDir = cmSystemTools::GetFilenamePath(*it); + std::string fileDir = cmSystemTools::GetFilenamePath(f); cmWorkingDirectory workdir(fileDir); std::string command = "\"" + lcovCommand + "\" " + lcovExtraFlags + " "; @@ -1383,7 +1365,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( *cont->OFS << " Errors: " << errors << std::endl; if (!res) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Problem running coverage on file: " << *it << std::endl); + "Problem running coverage on file: " << f << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << errors << std::endl); cont->Error++; @@ -1391,7 +1373,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( } if (retVal != 0) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Coverage command returned: " - << retVal << " while processing: " << *it << std::endl); + << retVal << " while processing: " << f << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } @@ -1405,15 +1387,14 @@ int cmCTestCoverageHandler::HandleLCovCoverage( this->Quiet); std::vector<std::string> lines; - std::vector<std::string>::iterator line; cmSystemTools::Split(output.c_str(), lines); - for (line = lines.begin(); line != lines.end(); ++line) { + for (std::string const& line : lines) { std::string sourceFile; std::string lcovFile; - if (line->empty()) { + if (line.empty()) { // Ignore empty line } // Look for LCOV files in binary directory @@ -1436,9 +1417,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(), gl.GetFiles().end()); - for (std::vector<std::string>::iterator a = lcovFiles.begin(); - a != lcovFiles.end(); ++a) { - lcovFile = *a; + for (std::string const& file : lcovFiles) { + lcovFile = file; cmsys::ifstream srcead(lcovFile.c_str()); if (!srcead) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -1460,10 +1440,9 @@ int cmCTestCoverageHandler::HandleLCovCoverage( sourceFile = srcname; actualSourceFile = srcname; - for (std::vector<std::string>::iterator t = lcovFiles.begin(); - t != lcovFiles.end(); ++t) { + for (std::string const& t : lcovFiles) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found LCOV File: " << *t << std::endl, + "Found LCOV File: " << t << std::endl, this->Quiet); } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -1560,10 +1539,9 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files) gl.RecurseOn(); gl.RecurseThroughSymlinksOff(); - for (LabelMapType::const_iterator lmi = this->TargetDirs.begin(); - lmi != this->TargetDirs.end(); ++lmi) { + for (auto const& lm : this->TargetDirs) { // Skip targets containing no interesting labels. - if (!this->IntersectsFilter(lmi->second)) { + if (!this->IntersectsFilter(lm.second)) { continue; } @@ -1571,12 +1549,12 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files) // support directory. cmCTestOptionalLog( this->CTest, HANDLER_VERBOSE_OUTPUT, - " globbing for coverage in: " << lmi->first << std::endl, this->Quiet); - std::string daGlob = lmi->first; + " globbing for coverage in: " << lm.first << std::endl, this->Quiet); + std::string daGlob = lm.first; daGlob += "/*.da"; gl.FindFiles(daGlob); files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); - daGlob = lmi->first; + daGlob = lm.first; daGlob += "/*.gcda"; gl.FindFiles(daGlob); files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); @@ -1639,14 +1617,13 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string tempDir = testingDir + "/CoverageInfo"; cmSystemTools::MakeDirectory(tempDir.c_str()); - std::vector<std::string>::iterator fileIt; int file_count = 0; - for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) { - std::string fileName = this->FindFile(cont, *fileIt); + for (std::string const& file : files) { + std::string fileName = this->FindFile(cont, file); if (fileName.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find source Python file corresponding to: " - << *fileIt << std::endl); + << file << std::endl); continue; } @@ -1658,11 +1635,11 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec = &cont->TotalCoverage[actualSourceFile]; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " in file: " << *fileIt << std::endl, this->Quiet); - cmsys::ifstream ifile(fileIt->c_str()); + " in file: " << file << std::endl, this->Quiet); + cmsys::ifstream ifile(file.c_str()); if (!ifile) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Cannot open file: " << *fileIt << std::endl); + "Cannot open file: " << file << std::endl); } else { long cnt = -1; std::string nl; @@ -2254,9 +2231,8 @@ void cmCTestCoverageHandler::WriteXMLLabels(cmXMLWriter& xml, LabelMapType::const_iterator li = this->SourceLabels.find(source); if (li != this->SourceLabels.end() && !li->second.empty()) { xml.StartElement("Labels"); - for (LabelSet::const_iterator lsi = li->second.begin(); - lsi != li->second.end(); ++lsi) { - xml.Element("Label", this->Labels[*lsi]); + for (auto const& ls : li->second) { + xml.Element("Label", this->Labels[ls]); } xml.EndElement(); // Labels } @@ -2266,9 +2242,8 @@ void cmCTestCoverageHandler::SetLabelFilter( std::set<std::string> const& labels) { this->LabelFilter.clear(); - for (std::set<std::string>::const_iterator li = labels.begin(); - li != labels.end(); ++li) { - this->LabelFilter.insert(this->GetLabelId(*li)); + for (std::string const& l : labels) { + this->LabelFilter.insert(this->GetLabelId(l)); } } @@ -2308,29 +2283,24 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles( { std::set<std::string> extraMatches; - for (std::vector<std::string>::iterator i = this->ExtraCoverageGlobs.begin(); - i != this->ExtraCoverageGlobs.end(); ++i) { + for (std::string const& ecg : this->ExtraCoverageGlobs) { cmsys::Glob gl; gl.RecurseOn(); gl.RecurseThroughSymlinksOff(); - std::string glob = cont->SourceDir + "/" + *i; + std::string glob = cont->SourceDir + "/" + ecg; gl.FindFiles(glob); std::vector<std::string> files = gl.GetFiles(); - for (std::vector<std::string>::iterator f = files.begin(); - f != files.end(); ++f) { - if (this->ShouldIDoCoverage(f->c_str(), cont->SourceDir.c_str(), + for (std::string const& f : files) { + if (this->ShouldIDoCoverage(f.c_str(), cont->SourceDir.c_str(), cont->BinaryDir.c_str())) { - extraMatches.insert(this->CTest->GetShortPathToFile(f->c_str())); + extraMatches.insert(this->CTest->GetShortPathToFile(f.c_str())); } } } if (!extraMatches.empty()) { - for (cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i = - cont->TotalCoverage.begin(); - i != cont->TotalCoverage.end(); ++i) { - std::string shortPath = - this->CTest->GetShortPathToFile(i->first.c_str()); + for (auto const& i : cont->TotalCoverage) { + std::string shortPath = this->CTest->GetShortPathToFile(i.first.c_str()); extraMatches.erase(shortPath); } } diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 83eb561..99ac5df 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -42,16 +42,16 @@ public: /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; cmCTestCoverageHandler(); - void Initialize() CM_OVERRIDE; + void Initialize() override; /** * This method is called when reading CTest custom file */ - void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; + void PopulateCustomVectors(cmMakefile* mf) override; /** Report coverage only for sources with these labels. */ void SetLabelFilter(std::set<std::string> const& labels); diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index b175d44..022afd2 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -61,12 +61,11 @@ size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/, void cmCTestCurl::SetCurlOptions(std::vector<std::string> const& args) { - for (std::vector<std::string>::const_iterator i = args.begin(); - i != args.end(); ++i) { - if (*i == "CURLOPT_SSL_VERIFYPEER_OFF") { + for (std::string const& arg : args) { + if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") { this->VerifyPeerOff = true; } - if (*i == "CURLOPT_SSL_VERIFYHOST_OFF") { + if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") { this->VerifyHostOff = true; } } @@ -146,12 +145,11 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, struct curl_slist* headers = ::curl_slist_append(nullptr, "Content-Type: text/xml"); // Add any additional headers that the user specified. - for (std::vector<std::string>::const_iterator h = this->HttpHeaders.begin(); - h != this->HttpHeaders.end(); ++h) { + for (std::string const& h : this->HttpHeaders) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Add HTTP Header: \"" << *h << "\"" << std::endl, + " Add HTTP Header: \"" << h << "\"" << std::endl, this->Quiet); - headers = ::curl_slist_append(headers, h->c_str()); + headers = ::curl_slist_append(headers, h.c_str()); } ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers); std::vector<char> responseData; @@ -213,13 +211,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url, // Add headers if any were specified. struct curl_slist* headers = nullptr; if (!this->HttpHeaders.empty()) { - for (std::vector<std::string>::const_iterator h = - this->HttpHeaders.begin(); - h != this->HttpHeaders.end(); ++h) { + for (std::string const& h : this->HttpHeaders) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Add HTTP Header: \"" << *h << "\"" << std::endl, + " Add HTTP Header: \"" << h << "\"" << std::endl, this->Quiet); - headers = ::curl_slist_append(headers, h->c_str()); + headers = ::curl_slist_append(headers, h.c_str()); } } diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 9a8b735..9425ece 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestEmptyBinaryDirectoryCommand* ni = new cmCTestEmptyBinaryDirectoryCommand; @@ -41,7 +41,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index ed8d932..7fe74af 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -46,7 +46,7 @@ public: private: std::string& Line1; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { // Only the first line is of interest. this->Line1 = this->Line; @@ -163,9 +163,8 @@ bool cmCTestGIT::UpdateByFetchAndReset() opts = this->CTest->GetCTestConfiguration("GITUpdateOptions"); } std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str()); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - git_fetch.push_back(ai->c_str()); + for (std::string const& arg : args) { + git_fetch.push_back(arg.c_str()); } // Sentinel argument. @@ -215,9 +214,8 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom) std::vector<std::string> git_custom_command; cmSystemTools::ExpandListArgument(custom, git_custom_command, true); std::vector<char const*> git_custom; - for (std::vector<std::string>::const_iterator i = git_custom_command.begin(); - i != git_custom_command.end(); ++i) { - git_custom.push_back(i->c_str()); + for (std::string const& i : git_custom_command) { + git_custom.push_back(i.c_str()); } git_custom.push_back(nullptr); @@ -356,7 +354,7 @@ protected: this->Changes.clear(); } - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->Line[0] == ':') { this->DiffField = DiffFieldChange; @@ -514,7 +512,7 @@ private: person.TimeZone = strtol(c, const_cast<char**>(&c), 10); } - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->Line.empty()) { if (this->Section == SectionBody && this->LineEnd == '\0') { @@ -655,9 +653,8 @@ bool cmCTestGIT::LoadModifications() OutputLogger err(this->Log, "di-err> "); this->RunChild(git_diff_index, &out, &err, nullptr, cmProcessOutput::UTF8); - for (std::vector<Change>::const_iterator ci = out.Changes.begin(); - ci != out.Changes.end(); ++ci) { - this->DoModification(PathModified, ci->Path); + for (Change const& c : out.Changes) { + this->DoModification(PathModified, c.Path); } return true; } diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index 222bc50..ade430f 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -22,15 +22,15 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestGIT(cmCTest* ctest, std::ostream& log); - ~cmCTestGIT() CM_OVERRIDE; + ~cmCTestGIT() override; private: unsigned int CurrentGitVersion; unsigned int GetGitVersion(); std::string GetWorkingRevision(); - bool NoteOldRevision() CM_OVERRIDE; - bool NoteNewRevision() CM_OVERRIDE; - bool UpdateImpl() CM_OVERRIDE; + bool NoteOldRevision() override; + bool NoteNewRevision() override; + bool UpdateImpl() override; std::string FindGitDir(); std::string FindTopDir(); @@ -39,8 +39,8 @@ private: bool UpdateByCustom(std::string const& custom); bool UpdateInternal(); - bool LoadRevisions() CM_OVERRIDE; - bool LoadModifications() CM_OVERRIDE; + bool LoadRevisions() override; + bool LoadModifications() override; // "public" needed by older Sun compilers public: diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 53a4018..ce8f709 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -57,10 +57,8 @@ void cmCTestGenericHandler::Initialize() this->AppendXML = false; this->TestLoad = 0; this->Options.clear(); - t_StringToString::iterator it; - for (it = this->PersistentOptions.begin(); - it != this->PersistentOptions.end(); ++it) { - this->Options[it->first] = it->second; + for (auto const& po : this->PersistentOptions) { + this->Options[po.first] = po.second; } } diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 25294b5..d2714d90 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -48,15 +48,14 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision, /* clang-format on */ // Update information about revisions of the changed files. - for (std::vector<Change>::const_iterator ci = changes.begin(); - ci != changes.end(); ++ci) { - if (const char* local = this->LocalPath(ci->Path)) { + for (Change const& c : changes) { + if (const char* local = this->LocalPath(c.Path)) { std::string dir = cmSystemTools::GetFilenamePath(local); std::string name = cmSystemTools::GetFilenameName(local); File& file = this->Dirs[dir][name]; file.PriorRev = file.Rev ? file.Rev : &this->PriorRev; file.Rev = &rev; - this->Log << " " << ci->Action << " " << local << " " + this->Log << " " << c.Action << " " << local << " " << "\n"; } } @@ -83,9 +82,9 @@ void cmCTestGlobalVC::WriteXMLDirectory(cmXMLWriter& xml, const char* slash = path.empty() ? "" : "/"; xml.StartElement("Directory"); xml.Element("Name", path); - for (Directory::const_iterator fi = dir.begin(); fi != dir.end(); ++fi) { - std::string full = path + slash + fi->first; - this->WriteXMLEntry(xml, path, fi->first, full, fi->second); + for (auto const& f : dir) { + std::string const full = path + slash + f.first; + this->WriteXMLEntry(xml, path, f.first, full, f.second); } xml.EndElement(); // Directory } @@ -114,10 +113,8 @@ bool cmCTestGlobalVC::WriteXMLUpdates(cmXMLWriter& xml) this->WriteXMLGlobal(xml); - for (std::map<std::string, Directory>::const_iterator di = - this->Dirs.begin(); - di != this->Dirs.end(); ++di) { - this->WriteXMLDirectory(xml, di->first, di->second); + for (auto const& d : this->Dirs) { + this->WriteXMLDirectory(xml, d.first, d.second); } return result; diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index b4bf077..76377ed 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -26,11 +26,11 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestGlobalVC(cmCTest* ctest, std::ostream& log); - ~cmCTestGlobalVC() CM_OVERRIDE; + ~cmCTestGlobalVC() override; protected: // Implement cmCTestVC internal API. - bool WriteXMLUpdates(cmXMLWriter& xml) CM_OVERRIDE; + bool WriteXMLUpdates(cmXMLWriter& xml) override; /** Represent a vcs-reported action for one path in a revision. */ struct Change diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 7bf5b67..735d92d 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -36,7 +36,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -60,7 +60,7 @@ private: cmCTestHG* HG; cmsys::RegularExpression RegexStatus; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], this->RegexStatus.match(2)); @@ -145,9 +145,8 @@ bool cmCTestHG::UpdateImpl() opts = this->CTest->GetCTestConfiguration("HGUpdateOptions"); } std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str()); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - hg_update.push_back(ai->c_str()); + for (std::string const& arg : args) { + hg_update.push_back(arg.c_str()); } // Sentinel argument. @@ -168,7 +167,7 @@ public: { this->InitializeParser(); } - ~LogParser() CM_OVERRIDE { this->CleanupParser(); } + ~LogParser() override { this->CleanupParser(); } private: cmCTestHG* HG; @@ -179,14 +178,14 @@ private: Change CurChange; std::vector<char> CData; - bool ProcessChunk(const char* data, int length) CM_OVERRIDE + bool ProcessChunk(const char* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { this->CData.clear(); if (name == "logentry") { @@ -198,12 +197,12 @@ private: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { this->CData.insert(this->CData.end(), data, data + length); } - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); @@ -217,25 +216,25 @@ private: this->Rev.Log.assign(&this->CData[0], this->CData.size()); } else if (!this->CData.empty() && name == "files") { std::vector<std::string> paths = this->SplitCData(); - for (unsigned int i = 0; i < paths.size(); ++i) { + for (std::string const& path : paths) { // Updated by default, will be modified using file_adds and // file_dels. this->CurChange = Change('U'); - this->CurChange.Path = paths[i]; + this->CurChange.Path = path; this->Changes.push_back(this->CurChange); } } else if (!this->CData.empty() && name == "file_adds") { std::string added_paths(this->CData.begin(), this->CData.end()); - for (unsigned int i = 0; i < this->Changes.size(); ++i) { - if (added_paths.find(this->Changes[i].Path) != std::string::npos) { - this->Changes[i].Action = 'A'; + for (Change& change : this->Changes) { + if (added_paths.find(change.Path) != std::string::npos) { + change.Action = 'A'; } } } else if (!this->CData.empty() && name == "file_dels") { std::string added_paths(this->CData.begin(), this->CData.end()); - for (unsigned int i = 0; i < this->Changes.size(); ++i) { - if (added_paths.find(this->Changes[i].Path) != std::string::npos) { - this->Changes[i].Action = 'D'; + for (Change& change : this->Changes) { + if (added_paths.find(change.Path) != std::string::npos) { + change.Action = 'D'; } } } @@ -246,9 +245,9 @@ private: { std::vector<std::string> output; std::string currPath; - for (unsigned int i = 0; i < this->CData.size(); ++i) { - if (this->CData[i] != ' ') { - currPath += this->CData[i]; + for (char i : this->CData) { + if (i != ' ') { + currPath += i; } else { output.push_back(currPath); currPath = ""; @@ -258,7 +257,7 @@ private: return output; } - void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) override { this->HG->Log << "Error parsing hg log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h index 90c38dc..c12d618 100644 --- a/Source/CTest/cmCTestHG.h +++ b/Source/CTest/cmCTestHG.h @@ -22,16 +22,16 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestHG(cmCTest* ctest, std::ostream& log); - ~cmCTestHG() CM_OVERRIDE; + ~cmCTestHG() override; private: std::string GetWorkingRevision(); - bool NoteOldRevision() CM_OVERRIDE; - bool NoteNewRevision() CM_OVERRIDE; - bool UpdateImpl() CM_OVERRIDE; + bool NoteOldRevision() override; + bool NoteNewRevision() override; + bool UpdateImpl() override; - bool LoadRevisions() CM_OVERRIDE; - bool LoadModifications() CM_OVERRIDE; + bool LoadRevisions() override; + bool LoadModifications() override; // Parsing helper classes. class IdentifyParser; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 9266d1f..5a7baf5 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -97,12 +97,11 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, // bad one so that CAPTURE_CMAKE_ERROR can override setting the // global error state bool foundBadArgument = false; - for (unsigned int i = 0; i < args.size(); ++i) { + for (std::string const& arg : args) { // Check this argument. - if (!this->CheckArgumentKeyword(args[i]) && - !this->CheckArgumentValue(args[i])) { + if (!this->CheckArgumentKeyword(arg) && !this->CheckArgumentValue(arg)) { std::ostringstream e; - e << "called with unknown argument \"" << args[i] << "\"."; + e << "called with unknown argument \"" << arg << "\"."; this->SetError(e.str()); foundBadArgument = true; } diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index b838074..79d61f3 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -34,7 +34,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; enum { diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 041cc92..453ae99 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -169,9 +169,8 @@ void cmCTestLaunch::ComputeFileNames() cmCryptoHash md5(cmCryptoHash::AlgoMD5); md5.Initialize(); md5.Append(this->CWD); - for (std::vector<std::string>::const_iterator ai = this->RealArgs.begin(); - ai != this->RealArgs.end(); ++ai) { - md5.Append(*ai); + for (std::string const& realArg : this->RealArgs) { + md5.Append(realArg); } this->LogHash = md5.FinalizeHex(); @@ -422,9 +421,8 @@ void cmCTestLaunch::WriteXMLCommand(cmXMLWriter& xml) if (!this->CWD.empty()) { xml.Element("WorkingDirectory", this->CWD); } - for (std::vector<std::string>::const_iterator ai = this->RealArgs.begin(); - ai != this->RealArgs.end(); ++ai) { - xml.Element("Argument", *ai); + for (std::string const& realArg : this->RealArgs) { + xml.Element("Argument", realArg); } xml.EndElement(); // Command } @@ -487,9 +485,8 @@ void cmCTestLaunch::WriteXMLLabels(cmXMLWriter& xml) if (!this->Labels.empty()) { xml.Comment("Interested parties"); xml.StartElement("Labels"); - for (std::set<std::string>::const_iterator li = this->Labels.begin(); - li != this->Labels.end(); ++li) { - xml.Element("Label", *li); + for (std::string const& label : this->Labels) { + xml.Element("Label", label); } xml.EndElement(); // Labels } @@ -597,9 +594,8 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname) bool cmCTestLaunch::Match(std::string const& line, std::vector<cmsys::RegularExpression>& regexps) { - for (std::vector<cmsys::RegularExpression>::iterator ri = regexps.begin(); - ri != regexps.end(); ++ri) { - if (ri->find(line.c_str())) { + for (cmsys::RegularExpression& r : regexps) { + if (r.find(line.c_str())) { return true; } } diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index aaa8c6b..b6b3c40 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -23,7 +23,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestMemCheckCommand* ni = new cmCTestMemCheckCommand; ni->CTest = this->CTest; @@ -32,9 +32,9 @@ public: } protected: - cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeActualHandler() override; - void ProcessAdditionalValues(cmCTestGenericHandler* handler) CM_OVERRIDE; + void ProcessAdditionalValues(cmCTestGenericHandler* handler) override; enum { diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 3f11543..6e46a31 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -47,7 +47,7 @@ public: this->CTest = c; this->SetErrorCallback(xmlReportError, c); } - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { if (name == "MemoryLeak" || name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); @@ -64,7 +64,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const std::string& /*name*/) CM_OVERRIDE {} + void EndElement(const std::string& /*name*/) override {} const char* GetAttribute(const char* name, const char** atts) { @@ -157,15 +157,13 @@ int cmCTestMemCheckHandler::PostProcessHandler() void cmCTestMemCheckHandler::GenerateTestCommand( std::vector<std::string>& args, int test) { - std::vector<std::string>::size_type pp; std::string index; std::ostringstream stream; std::string memcheckcommand = cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str()); stream << test; index = stream.str(); - for (pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp++) { - std::string arg = this->MemoryTesterDynamicOptions[pp]; + for (std::string arg : this->MemoryTesterDynamicOptions) { std::string::size_type pos = arg.find("??"); if (pos != std::string::npos) { arg.replace(pos, 2, index); @@ -180,18 +178,18 @@ void cmCTestMemCheckHandler::GenerateTestCommand( // via environment varaibles. std::string memTesterEnvironmentVariable = this->MemoryTesterEnvironmentVariable; - for (pp = 0; pp < this->MemoryTesterOptions.size(); pp++) { + for (std::string const& arg : this->MemoryTesterOptions) { if (!memTesterEnvironmentVariable.empty()) { // If we are using env to pass options, append all the options to // this string with space separation. - memTesterEnvironmentVariable += " " + this->MemoryTesterOptions[pp]; + memTesterEnvironmentVariable += " " + arg; } // for regular options just add them to args and memcheckcommand // which is just used for display else { - args.push_back(this->MemoryTesterOptions[pp]); + args.push_back(arg); memcheckcommand += " \""; - memcheckcommand += this->MemoryTesterOptions[pp]; + memcheckcommand += arg; memcheckcommand += "\""; } } @@ -326,9 +324,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) xml.Element("StartTestTime", this->StartTestTime); xml.StartElement("TestList"); cmCTestMemCheckHandler::TestResultsVector::size_type cc; - for (cc = 0; cc < this->TestResults.size(); cc++) { - cmCTestTestResult* result = &this->TestResults[cc]; - std::string testPath = result->Path + "/" + result->Name; + for (cmCTestTestResult const& result : this->TestResults) { + std::string testPath = result.Path + "/" + result.Name; xml.Element("Test", this->CTest->GetShortPathToFile(testPath.c_str())); } xml.EndElement(); // TestList @@ -336,12 +333,12 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) "-- Processing memory checking output:\n", this->Quiet); size_t total = this->TestResults.size(); for (cc = 0; cc < this->TestResults.size(); cc++) { - cmCTestTestResult* result = &this->TestResults[cc]; + cmCTestTestResult const& result = this->TestResults[cc]; std::string memcheckstr; std::vector<int> memcheckresults(this->ResultStrings.size(), 0); - bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr, - memcheckresults); - if (res && result->Status == cmCTestMemCheckHandler::COMPLETED) { + bool res = + this->ProcessMemCheckOutput(result.Output, memcheckstr, memcheckresults); + if (res && result.Status == cmCTestMemCheckHandler::COMPLETED) { continue; } this->CleanTestOutput( @@ -364,11 +361,11 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) xml.EndElement(); // Results if (memoryErrors > 0) { const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); - std::string outname = result->Name + " "; + std::string outname = result.Name + " "; outname.resize(maxTestNameWidth + 4, '.'); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cc + 1 << "/" << total << " MemCheck: #" - << result->TestCount << ": " << outname + << result.TestCount << ": " << outname << " Defects: " << memoryErrors << std::endl, this->Quiet); } @@ -729,12 +726,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( cmSystemTools::Split(str.c_str(), lines); std::ostringstream ostr; log = ""; - for (std::vector<std::string>::iterator i = lines.begin(); i != lines.end(); - ++i) { + for (std::string const& l : lines) { std::string resultFound; - if (leakWarning.find(*i)) { + if (leakWarning.find(l)) { resultFound = leakWarning.match(1) + " leak"; - } else if (sanitizerWarning.find(*i)) { + } else if (sanitizerWarning.find(l)) { resultFound = sanitizerWarning.match(1); } if (!resultFound.empty()) { @@ -747,7 +743,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( defects++; ostr << "<b>" << this->ResultStrings[idx] << "</b> "; } - ostr << *i << std::endl; + ostr << l << std::endl; } log = ostr.str(); this->DefectCount += defects; @@ -765,10 +761,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( int defects = 0; - for (std::vector<std::string>::iterator i = lines.begin(); i != lines.end(); - ++i) { + for (std::string const& l : lines) { std::vector<int>::size_type failure = this->ResultStrings.size(); - if (pfW.find(*i)) { + if (pfW.find(l)) { std::vector<int>::size_type cc; for (cc = 0; cc < this->ResultStrings.size(); cc++) { if (pfW.match(1) == this->ResultStrings[cc]) { @@ -788,7 +783,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( results[failure]++; defects++; } - ostr << *i << std::endl; + ostr << l << std::endl; } log = ostr.str(); @@ -908,11 +903,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( // Now put all all the non valgrind output into the test output // This should be last in case it gets truncated by the output // limiting code - for (std::vector<std::string::size_type>::iterator i = - nonValGrindOutput.begin(); - i != nonValGrindOutput.end(); ++i) { - totalOutputSize += lines[*i].size(); - ostr << lines[*i] << std::endl; + for (std::string::size_type i : nonValGrindOutput) { + totalOutputSize += lines[i].size(); + ostr << lines[i] << std::endl; if (!unlimitedOutput && totalOutputSize > static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) { @@ -963,8 +956,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( } } int defects = 0; - for (cc = 0; cc < parser.Errors.size(); ++cc) { - results[parser.Errors[cc]]++; + for (int err : parser.Errors) { + results[err]++; defects++; } cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: " @@ -991,9 +984,8 @@ void cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, int test) } else { std::vector<std::string> files; this->TestOutputFileNames(test, files); - for (std::vector<std::string>::iterator i = files.begin(); - i != files.end(); ++i) { - this->AppendMemTesterOutput(res, *i); + for (std::string const& f : files) { + this->AppendMemTesterOutput(res, f); } } } diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 1228c42..9218294 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -24,19 +24,18 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler public: typedef cmCTestTestHandler Superclass; - void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; + void PopulateCustomVectors(cmMakefile* mf) override; cmCTestMemCheckHandler(); - void Initialize() CM_OVERRIDE; + void Initialize() override; int GetDefectCount(); protected: - int PreProcessHandler() CM_OVERRIDE; - int PostProcessHandler() CM_OVERRIDE; - void GenerateTestCommand(std::vector<std::string>& args, - int test) CM_OVERRIDE; + int PreProcessHandler() override; + int PostProcessHandler() override; + void GenerateTestCommand(std::vector<std::string>& args, int test) override; private: enum @@ -121,7 +120,7 @@ private: /** * Generate the Dart compatible output */ - void GenerateDartOutput(cmXMLWriter& xml) CM_OVERRIDE; + void GenerateDartOutput(cmXMLWriter& xml) override; std::vector<std::string> CustomPreMemCheck; std::vector<std::string> CustomPostMemCheck; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 2c16a0d..c853373 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -64,10 +64,9 @@ void cmCTestMultiProcessHandler::SetTests(TestMap& tests, this->Properties = properties; this->Total = this->Tests.size(); // set test run map to false for all - for (TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); - ++i) { - this->TestRunningMap[i->first] = false; - this->TestFinishMap[i->first] = false; + for (auto const& t : this->Tests) { + this->TestRunningMap[t.first] = false; + this->TestFinishMap[t.first] = false; } if (!this->CTest->GetShowOnly()) { this->ReadCostData(); @@ -131,11 +130,10 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) // Find any failed dependencies for this test. We assume the more common // scenario has no failed tests, so make it the outer loop. - for (std::vector<std::string>::const_iterator it = this->Failed->begin(); - it != this->Failed->end(); ++it) { - if (this->Properties[test]->RequireSuccessDepends.find(*it) != + for (std::string const& f : *this->Failed) { + if (this->Properties[test]->RequireSuccessDepends.find(f) != this->Properties[test]->RequireSuccessDepends.end()) { - testRun->AddFailedDependency(*it); + testRun->AddFailedDependency(f); } } @@ -152,9 +150,8 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) return; } else { - for (TestMap::iterator j = this->Tests.begin(); j != this->Tests.end(); - ++j) { - j->second.erase(test); + for (auto& j : this->Tests) { + j.second.erase(test); } this->UnlockResources(test); @@ -183,10 +180,8 @@ void cmCTestMultiProcessHandler::LockResources(int index) void cmCTestMultiProcessHandler::UnlockResources(int index) { - for (std::set<std::string>::iterator i = - this->Properties[index]->LockedResources.begin(); - i != this->Properties[index]->LockedResources.end(); ++i) { - this->LockedResources.erase(*i); + for (std::string const& i : this->Properties[index]->LockedResources) { + this->LockedResources.erase(i); } if (this->Properties[index]->RunSerial) { this->SerialTestRunning = false; @@ -219,10 +214,8 @@ std::string cmCTestMultiProcessHandler::GetName(int test) bool cmCTestMultiProcessHandler::StartTest(int test) { // Check for locked resources - for (std::set<std::string>::iterator i = - this->Properties[test]->LockedResources.begin(); - i != this->Properties[test]->LockedResources.end(); ++i) { - if (this->LockedResources.find(*i) != this->LockedResources.end()) { + for (std::string const& i : this->Properties[test]->LockedResources) { + if (this->LockedResources.find(i) != this->LockedResources.end()) { return false; } } @@ -292,22 +285,22 @@ void cmCTestMultiProcessHandler::StartNextTests() } TestList copy = this->SortedTests; - for (TestList::iterator test = copy.begin(); test != copy.end(); ++test) { + for (auto const& test : copy) { // Take a nap if we're currently performing a RUN_SERIAL test. if (this->SerialTestRunning) { break; } // We can only start a RUN_SERIAL test if no other tests are also running. - if (this->Properties[*test]->RunSerial && this->RunningCount > 0) { + if (this->Properties[test]->RunSerial && this->RunningCount > 0) { continue; } - size_t processors = GetProcessorsUsed(*test); + size_t processors = GetProcessorsUsed(test); bool testLoadOk = true; if (this->TestLoad > 0) { if (processors <= spareLoad) { cmCTestLog(this->CTest, DEBUG, "OK to run " - << GetName(*test) << ", it requires " << processors + << GetName(test) << ", it requires " << processors << " procs & system load is: " << systemLoad << std::endl); allTestsFailedTestLoadCheck = false; @@ -318,10 +311,10 @@ void cmCTestMultiProcessHandler::StartNextTests() if (processors <= minProcessorsRequired) { minProcessorsRequired = processors; - testWithMinProcessors = GetName(*test); + testWithMinProcessors = GetName(test); } - if (testLoadOk && processors <= numToStart && this->StartTest(*test)) { + if (testLoadOk && processors <= numToStart && this->StartTest(test)) { if (this->StopTimePassed) { return; } @@ -368,18 +361,13 @@ bool cmCTestMultiProcessHandler::CheckOutput() } std::vector<cmCTestRunTest*> finished; std::string out, err; - for (std::set<cmCTestRunTest*>::const_iterator i = - this->RunningTests.begin(); - i != this->RunningTests.end(); ++i) { - cmCTestRunTest* p = *i; + for (cmCTestRunTest* p : this->RunningTests) { if (!p->CheckOutput()) { finished.push_back(p); } } - for (std::vector<cmCTestRunTest*>::iterator i = finished.begin(); - i != finished.end(); ++i) { + for (cmCTestRunTest* p : finished) { this->Completed++; - cmCTestRunTest* p = *i; int test = p->GetIndex(); bool testResult = p->EndTest(this->Completed, this->Total, true); @@ -392,9 +380,8 @@ bool cmCTestMultiProcessHandler::CheckOutput() } else { this->Failed->push_back(p->GetTestProperties()->Name); } - for (TestMap::iterator j = this->Tests.begin(); j != this->Tests.end(); - ++j) { - j->second.erase(test); + for (auto& t : this->Tests) { + t.second.erase(test); } this->TestFinishMap[test] = true; this->TestRunningMap[test] = false; @@ -451,16 +438,15 @@ void cmCTestMultiProcessHandler::UpdateCostData() } // Add all tests not previously listed in the file - for (PropertiesMap::iterator i = temp.begin(); i != temp.end(); ++i) { - fout << i->second->Name << " " << i->second->PreviousRuns << " " - << i->second->Cost << "\n"; + for (auto const& i : temp) { + fout << i.second->Name << " " << i.second->PreviousRuns << " " + << i.second->Cost << "\n"; } // Write list of failed tests fout << "---\n"; - for (std::vector<std::string>::iterator i = this->Failed->begin(); - i != this->Failed->end(); ++i) { - fout << *i << "\n"; + for (std::string const& f : *this->Failed) { + fout << f << "\n"; } fout.close(); cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str()); @@ -517,10 +503,9 @@ int cmCTestMultiProcessHandler::SearchByName(std::string const& name) { int index = -1; - for (PropertiesMap::iterator i = this->Properties.begin(); - i != this->Properties.end(); ++i) { - if (i->second->Name == name) { - index = i->first; + for (auto const& p : this->Properties) { + if (p.second->Name == name) { + index = p.first; } } return index; @@ -545,16 +530,15 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // In parallel test runs add previously failed tests to the front // of the cost list and queue other tests for further sorting - for (TestMap::const_iterator i = this->Tests.begin(); i != this->Tests.end(); - ++i) { + for (auto const& t : this->Tests) { if (std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), - this->Properties[i->first]->Name) != + this->Properties[t.first]->Name) != this->LastTestsFailed.end()) { // If the test failed last time, it should be run first. - this->SortedTests.push_back(i->first); - alreadySortedTests.insert(i->first); + this->SortedTests.push_back(t.first); + alreadySortedTests.insert(t.first); } else { - topLevel.insert(i->first); + topLevel.insert(t.first); } } @@ -566,15 +550,13 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() priorityStack.push_back(TestSet()); TestSet& currentSet = priorityStack.back(); - for (TestSet::const_iterator i = previousSet.begin(); - i != previousSet.end(); ++i) { - TestSet const& dependencies = this->Tests[*i]; + for (auto const& i : previousSet) { + TestSet const& dependencies = this->Tests[i]; currentSet.insert(dependencies.begin(), dependencies.end()); } - for (TestSet::const_iterator i = currentSet.begin(); i != currentSet.end(); - ++i) { - previousSet.erase(*i); + for (auto const& i : currentSet) { + previousSet.erase(i); } } @@ -594,11 +576,10 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp); - for (TestList::const_iterator j = sortedCopy.begin(); - j != sortedCopy.end(); ++j) { - if (alreadySortedTests.find(*j) == alreadySortedTests.end()) { - this->SortedTests.push_back(*j); - alreadySortedTests.insert(*j); + for (auto const& j : sortedCopy) { + if (alreadySortedTests.find(j) == alreadySortedTests.end()) { + this->SortedTests.push_back(j); + alreadySortedTests.insert(j); } } } @@ -608,10 +589,9 @@ void cmCTestMultiProcessHandler::GetAllTestDependencies(int test, TestList& dependencies) { TestSet const& dependencySet = this->Tests[test]; - for (TestSet::const_iterator i = dependencySet.begin(); - i != dependencySet.end(); ++i) { - GetAllTestDependencies(*i, dependencies); - dependencies.push_back(*i); + for (int i : dependencySet) { + GetAllTestDependencies(i, dependencies); + dependencies.push_back(i); } } @@ -619,9 +599,8 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() { TestList presortedList; - for (TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); - ++i) { - presortedList.push_back(i->first); + for (auto const& i : this->Tests) { + presortedList.push_back(i.first); } TestComparator comp(this); @@ -629,10 +608,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() TestSet alreadySortedTests; - for (TestList::const_iterator i = presortedList.begin(); - i != presortedList.end(); ++i) { - int test = *i; - + for (int test : presortedList) { if (alreadySortedTests.find(test) != alreadySortedTests.end()) { continue; } @@ -640,10 +616,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() TestList dependencies; GetAllTestDependencies(test, dependencies); - for (TestList::const_iterator j = dependencies.begin(); - j != dependencies.end(); ++j) { - int testDependency = *j; - + for (int testDependency : dependencies) { if (alreadySortedTests.find(testDependency) == alreadySortedTests.end()) { alreadySortedTests.insert(testDependency); @@ -679,10 +652,9 @@ void cmCTestMultiProcessHandler::PrintTestList() this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; - for (PropertiesMap::iterator it = this->Properties.begin(); - it != this->Properties.end(); ++it) { + for (auto& it : this->Properties) { count++; - cmCTestTestHandler::cmCTestTestProperties& p = *it->second; + cmCTestTestHandler::cmCTestTestProperties& p = *it.second; cmWorkingDirectory workdir(p.Directory); @@ -696,9 +668,8 @@ void cmCTestMultiProcessHandler::PrintTestList() cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:", this->Quiet); } - for (std::vector<std::string>::iterator label = p.Labels.begin(); - label != p.Labels.end(); ++label) { - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label, + for (std::string const& label : p.Labels) { + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << label, this->Quiet); } if (!p.Labels.empty()) // print the labels @@ -737,9 +708,8 @@ void cmCTestMultiProcessHandler::PrintTestList() void cmCTestMultiProcessHandler::PrintLabels() { std::set<std::string> allLabels; - for (PropertiesMap::iterator it = this->Properties.begin(); - it != this->Properties.end(); ++it) { - cmCTestTestHandler::cmCTestTestProperties& p = *it->second; + for (auto& it : this->Properties) { + cmCTestTestHandler::cmCTestTestProperties& p = *it.second; allLabels.insert(p.Labels.begin(), p.Labels.end()); } @@ -750,10 +720,9 @@ void cmCTestMultiProcessHandler::PrintLabels() cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl, this->Quiet); } - for (std::set<std::string>::iterator label = allLabels.begin(); - label != allLabels.end(); ++label) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " " << *label << std::endl, this->Quiet); + for (std::string const& label : allLabels) { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " " << label << std::endl, + this->Quiet); } } @@ -794,10 +763,9 @@ void cmCTestMultiProcessHandler::RemoveTest(int index) int cmCTestMultiProcessHandler::FindMaxIndex() { int max = 0; - cmCTestMultiProcessHandler::TestMap::iterator i = this->Tests.begin(); - for (; i != this->Tests.end(); ++i) { - if (i->first > max) { - max = i->first; + for (auto const& i : this->Tests) { + if (i.first > max) { + max = i.first; } } return max; @@ -809,10 +777,9 @@ bool cmCTestMultiProcessHandler::CheckCycles() cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Checking test dependency graph..." << std::endl, this->Quiet); - for (TestMap::iterator it = this->Tests.begin(); it != this->Tests.end(); - ++it) { + for (auto const& it : this->Tests) { // DFS from each element to itself - int root = it->first; + int root = it.first; std::set<int> visited; std::stack<int> s; s.push(root); @@ -820,9 +787,8 @@ bool cmCTestMultiProcessHandler::CheckCycles() int test = s.top(); s.pop(); if (visited.insert(test).second) { - for (TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) { - if (*d == root) { + for (auto const& d : this->Tests[test]) { + if (d == root) { // cycle exists cmCTestLog( this->CTest, ERROR_MESSAGE, @@ -832,7 +798,7 @@ bool cmCTestMultiProcessHandler::CheckCycles() << "\".\nPlease fix the cycle and run ctest again.\n"); return false; } - s.push(*d); + s.push(d); } } } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index ab057ad..11f6a00 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -37,7 +37,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -61,7 +61,7 @@ private: cmsys::RegularExpression RegexIdentify; cmCTestP4* P4; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexIdentify.find(this->Line)) { P4->ChangeLists.push_back(this->RegexIdentify.match(1)); @@ -84,7 +84,7 @@ private: cmsys::RegularExpression RegexUser; cmCTestP4* P4; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexUser.find(this->Line)) { User NewUser; @@ -127,7 +127,7 @@ private: std::string CurrentPath; cmsys::RegularExpression RegexDiff; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (!this->Line.empty() && this->Line[0] == '=' && this->RegexDiff.find(this->Line)) { @@ -217,7 +217,7 @@ private: SectionType Section; Revision Rev; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->Line.empty()) { this->NextSection(); @@ -332,9 +332,8 @@ void cmCTestP4::SetP4Options(std::vector<char const*>& CommandOptions) } CommandOptions.clear(); - for (std::vector<std::string>::iterator i = P4Options.begin(); - i != P4Options.end(); ++i) { - CommandOptions.push_back(i->c_str()); + for (std::string const& o : P4Options) { + CommandOptions.push_back(o.c_str()); } } @@ -465,9 +464,8 @@ bool cmCTestP4::UpdateCustom(const std::string& custom) cmSystemTools::ExpandListArgument(custom, p4_custom_command, true); std::vector<char const*> p4_custom; - for (std::vector<std::string>::const_iterator i = p4_custom_command.begin(); - i != p4_custom_command.end(); ++i) { - p4_custom.push_back(i->c_str()); + for (std::string const& i : p4_custom_command) { + p4_custom.push_back(i.c_str()); } p4_custom.push_back(nullptr); @@ -502,9 +500,8 @@ bool cmCTestP4::UpdateImpl() opts = this->CTest->GetCTestConfiguration("P4UpdateOptions"); } std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str()); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - p4_sync.push_back(ai->c_str()); + for (std::string const& arg : args) { + p4_sync.push_back(arg.c_str()); } std::string source = this->SourceDirectory + "/..."; diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index faeeaf2..b14edf7 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -24,7 +24,7 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestP4(cmCTest* ctest, std::ostream& log); - ~cmCTestP4() CM_OVERRIDE; + ~cmCTestP4() override; private: std::vector<std::string> ChangeLists; @@ -51,13 +51,13 @@ private: void SetP4Options(std::vector<char const*>& options); std::string GetWorkingRevision(); - bool NoteOldRevision() CM_OVERRIDE; - bool NoteNewRevision() CM_OVERRIDE; - bool UpdateImpl() CM_OVERRIDE; + bool NoteOldRevision() override; + bool NoteNewRevision() override; + bool UpdateImpl() override; bool UpdateCustom(const std::string& custom); - bool LoadRevisions() CM_OVERRIDE; - bool LoadModifications() CM_OVERRIDE; + bool LoadRevisions() override; + bool LoadModifications() override; class ChangesParser; class DescribeParser; diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index b21be87..ed14d06 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -14,9 +14,8 @@ bool cmCTestReadCustomFilesCommand::InitialPass( return false; } - std::vector<std::string>::const_iterator dit; - for (dit = args.begin(); dit != args.end(); ++dit) { - this->CTest->ReadCustomConfigurationFileTree(dit->c_str(), this->Makefile); + for (std::string const& arg : args) { + this->CTest->ReadCustomConfigurationFileTree(arg.c_str(), this->Makefile); } return true; diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 157710a..ba25c51 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand; ni->CTest = this->CTest; @@ -39,7 +39,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 9821c2e..9d8b4b5 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand; ni->CTest = this->CTest; @@ -40,7 +40,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index ddc309c..a71e2ec 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -64,12 +64,8 @@ bool cmCTestRunTest::CheckOutput() // Check for TIMEOUT_AFTER_MATCH property. if (!this->TestProperties->TimeoutRegularExpressions.empty()) { - std::vector<std::pair<cmsys::RegularExpression, std::string>>::iterator - regIt; - for (regIt = this->TestProperties->TimeoutRegularExpressions.begin(); - regIt != this->TestProperties->TimeoutRegularExpressions.end(); - ++regIt) { - if (regIt->first.find(this->ProcessOutput.c_str())) { + for (auto& reg : this->TestProperties->TimeoutRegularExpressions) { + if (reg.first.find(this->ProcessOutput.c_str())) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex() << ": " << "Test timeout changed to " @@ -163,18 +159,14 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) int res = started ? this->TestProcess->GetProcessStatus() : cmsysProcess_State_Error; int retVal = this->TestProcess->GetExitValue(); - std::vector<std::pair<cmsys::RegularExpression, std::string>>::iterator - passIt; bool forceFail = false; bool skipped = false; bool outputTestErrorsToConsole = false; if (!this->TestProperties->RequiredRegularExpressions.empty() && this->FailedDependencies.empty()) { bool found = false; - for (passIt = this->TestProperties->RequiredRegularExpressions.begin(); - passIt != this->TestProperties->RequiredRegularExpressions.end(); - ++passIt) { - if (passIt->first.find(this->ProcessOutput.c_str())) { + for (auto& pass : this->TestProperties->RequiredRegularExpressions) { + if (pass.first.find(this->ProcessOutput.c_str())) { found = true; reason = "Required regular expression found."; break; @@ -185,23 +177,19 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) forceFail = true; } reason += "Regex=["; - for (passIt = this->TestProperties->RequiredRegularExpressions.begin(); - passIt != this->TestProperties->RequiredRegularExpressions.end(); - ++passIt) { - reason += passIt->second; + for (auto& pass : this->TestProperties->RequiredRegularExpressions) { + reason += pass.second; reason += "\n"; } reason += "]"; } if (!this->TestProperties->ErrorRegularExpressions.empty() && this->FailedDependencies.empty()) { - for (passIt = this->TestProperties->ErrorRegularExpressions.begin(); - passIt != this->TestProperties->ErrorRegularExpressions.end(); - ++passIt) { - if (passIt->first.find(this->ProcessOutput.c_str())) { + for (auto& pass : this->TestProperties->ErrorRegularExpressions) { + if (pass.first.find(this->ProcessOutput.c_str())) { reason = "Error regular expression found in output."; reason += " Regex=["; - reason += passIt->second; + reason += pass.second; reason += "]"; forceFail = true; break; @@ -457,10 +445,8 @@ bool cmCTestRunTest::StartTest(size_t total) if (!this->FailedDependencies.empty()) { this->TestProcess = new cmProcess; std::string msg = "Failed test dependencies:"; - for (std::set<std::string>::const_iterator it = - this->FailedDependencies.begin(); - it != this->FailedDependencies.end(); ++it) { - msg += " " + *it; + for (std::string const& failedDep : this->FailedDependencies) { + msg += " " + failedDep; } *this->TestHandler->LogFile << msg << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, msg << std::endl); @@ -492,11 +478,7 @@ bool cmCTestRunTest::StartTest(size_t total) } // Check if all required files exist - for (std::vector<std::string>::iterator i = - this->TestProperties->RequiredFiles.begin(); - i != this->TestProperties->RequiredFiles.end(); ++i) { - std::string file = *i; - + for (std::string const& file : this->TestProperties->RequiredFiles) { if (!cmSystemTools::FileExists(file.c_str())) { // Required file was not found this->TestProcess = new cmProcess; @@ -560,10 +542,9 @@ void cmCTestRunTest::ComputeArguments() // Prepends memcheck args to our command string this->TestHandler->GenerateTestCommand(this->Arguments, this->Index); - for (std::vector<std::string>::iterator i = this->Arguments.begin(); - i != this->Arguments.end(); ++i) { + for (std::string const& arg : this->Arguments) { testCommand += " \""; - testCommand += *i; + testCommand += arg; testCommand += "\""; } @@ -587,10 +568,8 @@ void cmCTestRunTest::ComputeArguments() << ": " << "Environment variables: " << std::endl); } - for (std::vector<std::string>::const_iterator e = - this->TestProperties->Environment.begin(); - e != this->TestProperties->Environment.end(); ++e) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << *e + for (std::string const& env : this->TestProperties->Environment) { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << env << std::endl); } } @@ -764,9 +743,8 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << std::endl; *this->TestHandler->LogFile << "Command: \"" << this->ActualCommand << "\""; - for (std::vector<std::string>::iterator i = this->Arguments.begin(); - i != this->Arguments.end(); ++i) { - *this->TestHandler->LogFile << " \"" << *i << "\""; + for (std::string const& arg : this->Arguments) { + *this->TestHandler->LogFile << " \"" << arg << "\""; } *this->TestHandler->LogFile << std::endl diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 36582a2..087eb38 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -59,7 +59,7 @@ private: cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexRev.find(this->Line)) { this->Rev = this->RegexRev.match(1); @@ -103,10 +103,7 @@ bool cmCTestSVN::NoteOldRevision() return false; } - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { svninfo.OldRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' before update: " << svninfo.OldRevision << "\n"; @@ -127,10 +124,7 @@ bool cmCTestSVN::NoteNewRevision() return false; } - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { svninfo.NewRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' after update: " << svninfo.NewRevision << "\n"; @@ -205,7 +199,7 @@ private: cmCTestSVN* SVN; cmsys::RegularExpression RegexUpdate; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -257,9 +251,8 @@ bool cmCTestSVN::UpdateImpl() std::vector<char const*> svn_update; svn_update.push_back("update"); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - svn_update.push_back(ai->c_str()); + for (std::string const& arg : args) { + svn_update.push_back(arg.c_str()); } UpdateParser out(this, "up-out> "); @@ -285,9 +278,8 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters, std::vector<std::string> parsedUserOptions = cmSystemTools::ParseArguments(userOptions.c_str()); - for (std::vector<std::string>::iterator i = parsedUserOptions.begin(); - i != parsedUserOptions.end(); ++i) { - args.push_back(i->c_str()); + for (std::string const& opt : parsedUserOptions) { + args.push_back(opt.c_str()); } args.push_back(nullptr); @@ -309,7 +301,7 @@ public: { this->InitializeParser(); } - ~LogParser() CM_OVERRIDE { this->CleanupParser(); } + ~LogParser() override { this->CleanupParser(); } private: cmCTestSVN* SVN; cmCTestSVN::SVNInfo& SVNRepo; @@ -321,14 +313,14 @@ private: Change CurChange; std::vector<char> CData; - bool ProcessChunk(const char* data, int length) CM_OVERRIDE + bool ProcessChunk(const char* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { this->CData.clear(); if (name == "logentry") { @@ -346,12 +338,12 @@ private: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { this->CData.insert(this->CData.end(), data, data + length); } - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); @@ -370,7 +362,7 @@ private: this->CData.clear(); } - void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) override { this->SVN->Log << "Error parsing svn log xml: " << msg << "\n"; } @@ -380,10 +372,7 @@ bool cmCTestSVN::LoadRevisions() { bool result = true; // Get revisions for all the external repositories - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { result = this->LoadRevisions(svninfo) && result; } return result; @@ -441,7 +430,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexStatus; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], @@ -507,7 +496,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexExternal; - bool ProcessLine() CM_OVERRIDE + bool ProcessLine() override { if (this->RegexExternal.find(this->Line)) { this->DoPath(this->RegexExternal.match(1)); diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 94af837..dbc7fde 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -24,14 +24,14 @@ public: /** Construct with a CTest instance and update log stream. */ cmCTestSVN(cmCTest* ctest, std::ostream& log); - ~cmCTestSVN() CM_OVERRIDE; + ~cmCTestSVN() override; private: // Implement cmCTestVC internal API. - void CleanupImpl() CM_OVERRIDE; - bool NoteOldRevision() CM_OVERRIDE; - bool NoteNewRevision() CM_OVERRIDE; - bool UpdateImpl() CM_OVERRIDE; + void CleanupImpl() override; + bool NoteOldRevision() override; + bool NoteNewRevision() override; + bool UpdateImpl() override; bool RunSVNCommand(std::vector<char const*> const& parameters, OutputParser* out, OutputParser* err); @@ -77,8 +77,8 @@ private: std::string LoadInfo(SVNInfo& svninfo); bool LoadRepositories(); - bool LoadModifications() CM_OVERRIDE; - bool LoadRevisions() CM_OVERRIDE; + bool LoadModifications() override; + bool LoadRevisions() override; bool LoadRevisions(SVNInfo& svninfo); void GuessBase(SVNInfo& svninfo, std::vector<Change> const& changes); @@ -86,7 +86,7 @@ private: void DoRevisionSVN(Revision const& revision, std::vector<Change> const& changes); - void WriteXMLGlobal(cmXMLWriter& xml) CM_OVERRIDE; + void WriteXMLGlobal(cmXMLWriter& xml) override; class ExternalParser; // Parsing helper classes. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 6fd24a5..bb3e96d 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -52,9 +52,9 @@ class cmCTestScriptFunctionBlocker : public cmFunctionBlocker { public: cmCTestScriptFunctionBlocker() {} - ~cmCTestScriptFunctionBlocker() CM_OVERRIDE {} + ~cmCTestScriptFunctionBlocker() override {} bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus& /*status*/) CM_OVERRIDE; + cmExecutionStatus& /*status*/) override; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); // virtual void ScopeEnded(cmMakefile &mf); @@ -245,10 +245,9 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) std::ostringstream message; message << "Error running command: ["; message << result << "] "; - for (std::vector<const char*>::iterator i = argv.begin(); i != argv.end(); - ++i) { - if (*i) { - message << *i << " "; + for (const char* arg : argv) { + if (arg) { + message << arg << " "; } } cmCTestLog(this->CTest, ERROR_MESSAGE, message.str() << argv[0] @@ -377,9 +376,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // Add definitions of variables passed in on the command line: const std::map<std::string, std::string>& defs = this->CTest->GetDefinitions(); - for (std::map<std::string, std::string>::const_iterator it = defs.begin(); - it != defs.end(); ++it) { - this->Makefile->AddDefinition(it->first, it->second.c_str()); + for (auto const& d : defs) { + this->Makefile->AddDefinition(d.first, d.second.c_str()); } // finally read in the script @@ -654,10 +652,9 @@ int cmCTestScriptHandler::PerformExtraUpdates() // do an initial cvs update as required command = this->UpdateCmd; - std::vector<std::string>::iterator it; - for (it = this->ExtraUpdates.begin(); it != this->ExtraUpdates.end(); ++it) { + for (std::string const& eu : this->ExtraUpdates) { std::vector<std::string> cvsArgs; - cmSystemTools::ExpandListArgument(*it, cvsArgs); + cmSystemTools::ExpandListArgument(eu, cvsArgs); if (cvsArgs.size() == 2) { std::string fullCommand = command; fullCommand += " update "; @@ -670,7 +667,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); if (!res || retVal != 0) { - cmSystemTools::Error("Unable to perform extra updates:\n", it->c_str(), + cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(), "\nWith output:\n", output.c_str()); return 0; } @@ -803,8 +800,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() std::vector<std::string> ctestCommands; cmSystemTools::ExpandListArgument(this->CTestCmd, ctestCommands); // for each variable/argument do a putenv - for (unsigned i = 0; i < ctestCommands.size(); ++i) { - command = ctestCommands[i]; + for (std::string const& ctestCommand : ctestCommands) { + command = ctestCommand; output = ""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index c2631ce..b6cd97b 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -65,7 +65,7 @@ public: /** * Run a dashboard using a specified confiuration script */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; /* * Run a script @@ -98,9 +98,9 @@ public: double GetRemainingTimeAllowed(); cmCTestScriptHandler(); - ~cmCTestScriptHandler() CM_OVERRIDE; + ~cmCTestScriptHandler() override; - void Initialize() CM_OVERRIDE; + void Initialize() override; void CreateCMake(); cmake* GetCMake() { return this->CMake; } diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index ade9c96..5cd185a 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestSleepCommand* ni = new cmCTestSleepCommand; ni->CTest = this->CTest; @@ -40,7 +40,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 2e02838..542f27c 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestStartCommand* ni = new cmCTestStartCommand; ni->CTest = this->CTest; @@ -42,7 +42,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * Will this invocation of ctest_start create a new TAG file? diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 44f0d68..c4b84ce 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -38,7 +38,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestSubmitCommand* ni = new cmCTestSubmitCommand; ni->CTest = this->CTest; @@ -47,20 +47,20 @@ public: } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_submit"; } + std::string GetName() const override { return "ctest_submit"; } typedef cmCTestHandlerCommand Superclass; protected: - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; - bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; - bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentKeyword(std::string const& arg) override; + bool CheckArgumentValue(std::string const& arg) override; enum { diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index b7d0d1f..371d2d5 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -38,7 +38,7 @@ class cmCTestSubmitHandler::ResponseParser : public cmXMLParser { public: ResponseParser() { this->Status = STATUS_OK; } - ~ResponseParser() CM_OVERRIDE {} + ~ResponseParser() override {} public: enum StatusType @@ -66,17 +66,17 @@ private: } void StartElement(const std::string& /*name*/, - const char** /*atts*/) CM_OVERRIDE + const char** /*atts*/) override { this->CurrentValue.clear(); } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { this->CurrentValue.insert(this->CurrentValue.end(), data, data + length); } - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); @@ -162,8 +162,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { /* get a curl handle */ curl = curl_easy_init(); if (curl) { @@ -192,12 +191,12 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); - std::string local_file = *file; + std::string local_file = file; if (!cmSystemTools::FileExists(local_file.c_str())) { - local_file = localprefix + "/" + *file; + local_file = localprefix + "/" + file; } std::string upload_as = - url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file); + url + "/" + remoteprefix + cmSystemTools::GetFilenameName(file); if (!cmSystemTools::FileExists(local_file.c_str())) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -307,12 +306,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_slist_append(nullptr, "Content-Type: text/xml"); // Add any additional headers that the user specified. - for (std::vector<std::string>::const_iterator h = this->HttpHeaders.begin(); - h != this->HttpHeaders.end(); ++h) { + for (std::string const& h : this->HttpHeaders) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Add HTTP Header: \"" << *h << "\"" << std::endl, + " Add HTTP Header: \"" << h << "\"" << std::endl, this->Quiet); - headers = ::curl_slist_append(headers, h->c_str()); + headers = ::curl_slist_append(headers, h.c_str()); } /* In windows, this will init the winsock stuff */ @@ -323,18 +321,15 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmSystemTools::ExpandListArgument(curlopt, args); bool verifyPeerOff = false; bool verifyHostOff = false; - for (std::vector<std::string>::iterator i = args.begin(); i != args.end(); - ++i) { - if (*i == "CURLOPT_SSL_VERIFYPEER_OFF") { + for (std::string const& arg : args) { + if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") { verifyPeerOff = true; } - if (*i == "CURLOPT_SSL_VERIFYHOST_OFF") { + if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") { verifyHostOff = true; } } - std::string::size_type kk; - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { /* get a curl handle */ curl = curl_easy_init(); if (curl) { @@ -389,19 +384,18 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - std::string local_file = *file; + std::string local_file = file; if (!cmSystemTools::FileExists(local_file.c_str())) { - local_file = localprefix + "/" + *file; + local_file = localprefix + "/" + file; } std::string remote_file = - remoteprefix + cmSystemTools::GetFilenameName(*file); + remoteprefix + cmSystemTools::GetFilenameName(file); *this->LogFile << "\tUpload file: " << local_file << " to " << remote_file << std::endl; std::string ofile; - for (kk = 0; kk < remote_file.size(); kk++) { - char c = remote_file[kk]; + for (char c : remote_file) { char hexCh[4] = { 0, 0, 0, 0 }; hexCh[0] = c; switch (c) { @@ -629,8 +623,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { /* get a curl handle */ curl = curl_easy_init(); if (curl) { @@ -670,11 +663,9 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, ::curl_easy_setopt(curl, CURLOPT_FILE, &chunk); ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug); - std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file); + std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(file); std::string ofile; - std::string::iterator kk; - for (kk = rfile.begin(); kk < rfile.end(); ++kk) { - char c = *kk; + for (char c : rfile) { char hexCh[4] = { 0, 0, 0, 0 }; hexCh[0] = c; switch (c) { @@ -772,16 +763,15 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, int problems = 0; - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { int retVal; std::string lfname = localprefix; cmSystemTools::ConvertToUnixSlashes(lfname); - lfname += "/" + *file; + lfname += "/" + file; lfname = cmSystemTools::ConvertToOutputPath(lfname.c_str()); argv[1] = lfname.c_str(); - std::string rfname = url + "/" + remoteprefix + *file; + std::string rfname = url + "/" + remoteprefix + file; argv[2] = rfname.c_str(); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" << argv[2] @@ -864,12 +854,11 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix, return false; } - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { std::string lfname = localprefix; cmSystemTools::ConvertToUnixSlashes(lfname); - lfname += "/" + *file; - std::string rfname = destination + "/" + remoteprefix + *file; + lfname += "/" + file; + std::string rfname = destination + "/" + remoteprefix + file; cmSystemTools::CopyFileAlways(lfname, rfname); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " << lfname << " to " << rfname << std::endl, @@ -902,13 +891,12 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " << realURL << " (" << remoteprefix << ")" << std::endl, this->Quiet); - cmCTest::SetOfStrings::const_iterator file; - for (file = files.begin(); file != files.end(); ++file) { + for (std::string const& file : files) { xmlrpc_value* result; - std::string local_file = *file; + std::string local_file = file; if (!cmSystemTools::FileExists(local_file.c_str())) { - local_file = localprefix + "/" + *file; + local_file = localprefix + "/" + file; } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submit file: " << local_file << std::endl, @@ -1323,13 +1311,11 @@ int cmCTestSubmitHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, DEBUG, "Globbing for: " << gpath << std::endl, this->Quiet); if (cmSystemTools::SimpleGlob(gpath, gfiles, 1)) { - size_t cc; - for (cc = 0; cc < gfiles.size(); cc++) { - gfiles[cc] = gfiles[cc].substr(glen); + for (std::string& gfile : gfiles) { + gfile = gfile.substr(glen); cmCTestOptionalLog(this->CTest, DEBUG, - "Glob file: " << gfiles[cc] << std::endl, - this->Quiet); - this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); + "Glob file: " << gfile << std::endl, this->Quiet); + this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfile.c_str()); } } else { cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem globbing" << std::endl); @@ -1356,9 +1342,8 @@ int cmCTestSubmitHandler::ProcessHandler() if (ofs) { ofs << "Upload files:" << std::endl; int cnt = 0; - cmCTest::SetOfStrings::iterator it; - for (it = files.begin(); it != files.end(); ++it) { - ofs << cnt << "\t" << *it << std::endl; + for (std::string const& file : files) { + ofs << cnt << "\t" << file << std::endl; cnt++; } } diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 7b409fb..b4d0e77 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -25,14 +25,14 @@ public: typedef cmCTestGenericHandler Superclass; cmCTestSubmitHandler(); - ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = nullptr; } + ~cmCTestSubmitHandler() override { this->LogFile = nullptr; } /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; - void Initialize() CM_OVERRIDE; + void Initialize() override; /** Specify a set of parts (by name) to submit. */ void SelectParts(std::set<cmCTest::Part> const& parts); diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index e8c8c60..11c0db9 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestTestCommand* ni = new cmCTestTestCommand; ni->CTest = this->CTest; @@ -36,11 +36,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_test"; } + std::string GetName() const override { return "ctest_test"; } protected: virtual cmCTestGenericHandler* InitializeActualHandler(); - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; enum { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9962c49..c99c4fb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -41,7 +41,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestSubdirCommand* c = new cmCTestSubdirCommand; c->TestHandler = this->TestHandler; @@ -53,7 +53,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& /*unused*/) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) override; cmCTestTestHandler* TestHandler; }; @@ -65,17 +65,16 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, this->SetError("called with incorrect number of arguments"); return false; } - std::vector<std::string>::const_iterator it; std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - for (it = args.begin(); it != args.end(); ++it) { + for (std::string const& arg : args) { std::string fname; - if (cmSystemTools::FileIsFullPath(it->c_str())) { - fname = *it; + if (cmSystemTools::FileIsFullPath(arg.c_str())) { + fname = arg; } else { fname = cwd; fname += "/"; - fname += *it; + fname += arg; } if (!cmSystemTools::FileIsDirectory(fname)) { @@ -116,7 +115,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand; c->TestHandler = this->TestHandler; @@ -128,7 +127,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& /*unused*/) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) override; cmCTestTestHandler* TestHandler; }; @@ -181,7 +180,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestAddTestCommand* c = new cmCTestAddTestCommand; c->TestHandler = this->TestHandler; @@ -193,7 +192,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& /*args*/, - cmExecutionStatus& /*unused*/) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) override; cmCTestTestHandler* TestHandler; }; @@ -214,7 +213,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand; c->TestHandler = this->TestHandler; @@ -226,7 +225,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& /*args*/, - cmExecutionStatus& /*unused*/) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) override; cmCTestTestHandler* TestHandler; }; @@ -243,7 +242,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestSetDirectoryPropertiesCommand* c = new cmCTestSetDirectoryPropertiesCommand; @@ -256,7 +255,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& /*unused*/, - cmExecutionStatus& /*unused*/) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) override; cmCTestTestHandler* TestHandler; }; @@ -505,10 +504,9 @@ int cmCTestTestHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << "The following tests passed:" << std::endl, this->Quiet); - for (std::vector<std::string>::iterator j = passed.begin(); - j != passed.end(); ++j) { + for (std::string const& j : passed) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "\t" << *j << std::endl, this->Quiet); + "\t" << j << std::endl, this->Quiet); } } @@ -518,11 +516,10 @@ int cmCTestTestHandler::ProcessHandler() SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end()); std::vector<cmCTestTestHandler::cmCTestTestResult> disabledTests; - for (SetOfTests::iterator ftit = resultsSet.begin(); - ftit != resultsSet.end(); ++ftit) { - if (cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") || - ftit->CompletionStatus == "Disabled") { - disabledTests.push_back(*ftit); + for (cmCTestTestResult const& ft : resultsSet) { + if (cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") || + ft.CompletionStatus == "Disabled") { + disabledTests.push_back(ft); } } @@ -555,17 +552,15 @@ int cmCTestTestHandler::ProcessHandler() this->StartLogFile("TestsDisabled", ofs); const char* disabled_reason; - for (std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator dtit = - disabledTests.begin(); - dtit != disabledTests.end(); ++dtit) { - ofs << dtit->TestCount << ":" << dtit->Name << std::endl; - if (dtit->CompletionStatus == "Disabled") { + for (cmCTestTestResult const& dt : disabledTests) { + ofs << dt.TestCount << ":" << dt.Name << std::endl; + if (dt.CompletionStatus == "Disabled") { disabled_reason = "Disabled"; } else { disabled_reason = "Skipped"; } cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" - << std::setw(3) << dtit->TestCount << " - " << dtit->Name + << std::setw(3) << dt.TestCount << " - " << dt.Name << " (" << disabled_reason << ")" << std::endl); } } @@ -576,16 +571,14 @@ int cmCTestTestHandler::ProcessHandler() << "The following tests FAILED:" << std::endl); this->StartLogFile("TestsFailed", ofs); - for (SetOfTests::iterator ftit = resultsSet.begin(); - ftit != resultsSet.end(); ++ftit) { - if (ftit->Status != cmCTestTestHandler::COMPLETED && - !cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") && - ftit->CompletionStatus != "Disabled") { - ofs << ftit->TestCount << ":" << ftit->Name << std::endl; + for (cmCTestTestResult const& ft : resultsSet) { + if (ft.Status != cmCTestTestHandler::COMPLETED && + !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") && + ft.CompletionStatus != "Disabled") { + ofs << ft.TestCount << ":" << ft.Name << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" - << std::setw(3) << ftit->TestCount << " - " - << ftit->Name << " (" << this->GetTestStatus(&*ftit) - << ")" << std::endl); + << std::setw(3) << ft.TestCount << " - " << ft.Name + << " (" << this->GetTestStatus(ft) << ")" << std::endl); } } } @@ -629,15 +622,12 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) std::set<std::string> labels; std::string::size_type maxlen = 0; // initialize maps - for (cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); - it != this->TestList.end(); ++it) { - cmCTestTestProperties& p = *it; - for (std::vector<std::string>::iterator l = p.Labels.begin(); - l != p.Labels.end(); ++l) { + for (cmCTestTestProperties& p : this->TestList) { + for (std::string const& l : p.Labels) { // first check to see if the current label is a subproject label bool isSubprojectLabel = false; std::vector<std::string>::iterator subproject = - std::find(subprojects.begin(), subprojects.end(), *l); + std::find(subprojects.begin(), subprojects.end(), l); if (subproject != subprojects.end()) { isSubprojectLabel = true; } @@ -645,27 +635,23 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) // if we are not doing sub projects and the label is not one use it if ((doSubProject && isSubprojectLabel) || (!doSubProject && !isSubprojectLabel)) { - if ((*l).size() > maxlen) { - maxlen = (*l).size(); + if (l.size() > maxlen) { + maxlen = l.size(); } - labels.insert(*l); - labelTimes[*l] = 0; - labelCounts[*l] = 0; + labels.insert(l); + labelTimes[l] = 0; + labelCounts[l] = 0; } } } // fill maps - for (cmCTestTestHandler::TestResultsVector::iterator ri = - this->TestResults.begin(); - ri != this->TestResults.end(); ++ri) { - cmCTestTestResult& result = *ri; + for (cmCTestTestResult& result : this->TestResults) { cmCTestTestProperties& p = *result.Properties; - for (std::vector<std::string>::iterator l = p.Labels.begin(); - l != p.Labels.end(); ++l) { + for (std::string const& l : p.Labels) { // only use labels found in labels - if (labels.find(*l) != labels.end()) { - labelTimes[*l] += result.ExecutionTime * result.Properties->Processors; - ++labelCounts[*l]; + if (labels.find(l) != labels.end()) { + labelTimes[l] += result.ExecutionTime * result.Properties->Processors; + ++labelCounts[l]; } } } @@ -681,17 +667,16 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:", this->Quiet); } - for (std::set<std::string>::const_iterator i = labels.begin(); - i != labels.end(); ++i) { - std::string label = *i; + for (std::string const& i : labels) { + std::string label = i; label.resize(maxlen + 3, ' '); char buf[1024]; - sprintf(buf, "%6.2f sec*proc", labelTimes[*i]); + sprintf(buf, "%6.2f sec*proc", labelTimes[i]); std::ostringstream labelCountStr; - labelCountStr << "(" << labelCounts[*i] << " test"; - if (labelCounts[*i] > 1) { + labelCountStr << "(" << labelCounts[i] << " test"; + if (labelCounts[i] > 1) { labelCountStr << "s"; } labelCountStr << ")"; @@ -700,7 +685,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) << labelCountStr.str(), this->Quiet); if (this->LogFile) { - *this->LogFile << "\n" << *i << " = " << buf << "\n"; + *this->LogFile << "\n" << i << " = " << buf << "\n"; } } if (this->LogFile) { @@ -724,9 +709,8 @@ void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it) // check to see if the label regular expression matches bool found = false; // assume it does not match // loop over all labels and look for match - for (std::vector<std::string>::iterator l = it.Labels.begin(); - l != it.Labels.end(); ++l) { - if (this->IncludeLabelRegularExpression.find(*l)) { + for (std::string const& l : it.Labels) { + if (this->IncludeLabelRegularExpression.find(l)) { found = true; } } @@ -750,9 +734,8 @@ void cmCTestTestHandler::CheckLabelFilterExclude(cmCTestTestProperties& it) // check to see if the label regular expression matches bool found = false; // assume it does not match // loop over all labels and look for match - for (std::vector<std::string>::iterator l = it.Labels.begin(); - l != it.Labels.end(); ++l) { - if (this->ExcludeLabelRegularExpression.find(*l)) { + for (std::string const& l : it.Labels) { + if (this->ExcludeLabelRegularExpression.find(l)) { found = true; } } @@ -781,10 +764,9 @@ void cmCTestTestHandler::ComputeTestList() cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size(); // how many tests are in based on RegExp? int inREcnt = 0; - cmCTestTestHandler::ListOfTests::iterator it; - for (it = this->TestList.begin(); it != this->TestList.end(); it++) { - this->CheckLabelFilter(*it); - if (it->IsInBasedOnREOptions) { + for (cmCTestTestProperties& tp : this->TestList) { + this->CheckLabelFilter(tp); + if (tp.IsInBasedOnREOptions) { inREcnt++; } } @@ -799,9 +781,9 @@ void cmCTestTestHandler::ComputeTestList() inREcnt = 0; std::string last_directory; ListOfTests finalList; - for (it = this->TestList.begin(); it != this->TestList.end(); it++) { + for (cmCTestTestProperties& tp : this->TestList) { cnt++; - if (it->IsInBasedOnREOptions) { + if (tp.IsInBasedOnREOptions) { inREcnt++; } @@ -810,7 +792,7 @@ void cmCTestTestHandler::ComputeTestList() if ((!this->TestsToRun.empty() && std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) == this->TestsToRun.end()) && - !it->IsInBasedOnREOptions) { + !tp.IsInBasedOnREOptions) { continue; } } else { @@ -818,12 +800,12 @@ void cmCTestTestHandler::ComputeTestList() if ((!this->TestsToRun.empty() && std::find(this->TestsToRun.begin(), this->TestsToRun.end(), inREcnt) == this->TestsToRun.end()) || - !it->IsInBasedOnREOptions) { + !tp.IsInBasedOnREOptions) { continue; } } - it->Index = cnt; // save the index into the test list for this test - finalList.push_back(*it); + tp.Index = cnt; // save the index into the test list for this test + finalList.push_back(tp); } UpdateForFixtures(finalList); @@ -840,10 +822,9 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() { this->ExpandTestsToRunInformationForRerunFailed(); - cmCTestTestHandler::ListOfTests::iterator it; ListOfTests finalList; int cnt = 0; - for (it = this->TestList.begin(); it != this->TestList.end(); it++) { + for (cmCTestTestProperties& tp : this->TestList) { cnt++; // if this test is not in our list of tests to run, then skip it. @@ -853,8 +834,8 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() continue; } - it->Index = cnt; - finalList.push_back(*it); + tp.Index = cnt; + finalList.push_back(tp); } UpdateForFixtures(finalList); @@ -908,24 +889,18 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const it != this->TestList.end(); ++it) { const cmCTestTestProperties& p = *it; - const std::set<std::string>& setups = p.FixturesSetup; - for (std::set<std::string>::const_iterator depsIt = setups.begin(); - depsIt != setups.end(); ++depsIt) { - fixtureSetups.insert(std::make_pair(*depsIt, it)); + for (std::string const& deps : p.FixturesSetup) { + fixtureSetups.insert(std::make_pair(deps, it)); } - const std::set<std::string>& cleanups = p.FixturesCleanup; - for (std::set<std::string>::const_iterator depsIt = cleanups.begin(); - depsIt != cleanups.end(); ++depsIt) { - fixtureCleanups.insert(std::make_pair(*depsIt, it)); + for (std::string const& deps : p.FixturesCleanup) { + fixtureCleanups.insert(std::make_pair(deps, it)); } } // Prepare fast lookup of tests already included in our list of tests std::set<std::string> addedTests; - for (ListOfTests::const_iterator it = tests.begin(); it != tests.end(); - ++it) { - const cmCTestTestProperties& p = *it; + for (cmCTestTestProperties const& p : tests) { addedTests.insert(p.Name); } @@ -959,10 +934,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // Must copy the set of fixtures required because we may invalidate // the tests array by appending to it std::set<std::string> fixtures = tests[i].FixturesRequired; - for (std::set<std::string>::const_iterator fixturesIt = fixtures.begin(); - fixturesIt != fixtures.end(); ++fixturesIt) { - - const std::string& requiredFixtureName = *fixturesIt; + for (std::string const& requiredFixtureName : fixtures) { if (requiredFixtureName.empty()) { continue; } @@ -1061,11 +1033,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const } // 2. Record all setup fixtures included in the final list of tests - for (std::set<std::string>::const_iterator fixturesIt = - tests[i].FixturesSetup.begin(); - fixturesIt != tests[i].FixturesSetup.end(); ++fixturesIt) { - - const std::string& setupFixtureName = *fixturesIt; + for (std::string const& setupFixtureName : tests[i].FixturesSetup) { if (setupFixtureName.empty()) { continue; } @@ -1079,13 +1047,9 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // setup tests for that fixture. The latter is required to handle the // pathological case where setup and cleanup tests are in the test set // but no other test has that fixture as a requirement. - for (ListOfTests::iterator tIt = tests.begin(); tIt != tests.end(); ++tIt) { - cmCTestTestProperties& p = *tIt; + for (cmCTestTestProperties& p : tests) { const std::set<std::string>& cleanups = p.FixturesCleanup; - for (std::set<std::string>::const_iterator fIt = cleanups.begin(); - fIt != cleanups.end(); ++fIt) { - const std::string& fixture = *fIt; - + for (std::string const& fixture : cleanups) { // This cleanup test could be part of the original test list that was // passed in. It is then possible that no other test requires the // fIt fixture, so we have to check for this. @@ -1093,9 +1057,8 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const fixtureRequirements.find(fixture); if (cIt != fixtureRequirements.end()) { const std::vector<size_t>& indices = cIt->second; - for (std::vector<size_t>::const_iterator indexIt = indices.begin(); - indexIt != indices.end(); ++indexIt) { - const std::string& reqTestName = tests[*indexIt].Name; + for (size_t index : indices) { + const std::string& reqTestName = tests[index].Name; if (std::find(p.Depends.begin(), p.Depends.end(), reqTestName) == p.Depends.end()) { p.Depends.push_back(reqTestName); @@ -1108,9 +1071,8 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const cIt = setupFixturesAdded.find(fixture); if (cIt != setupFixturesAdded.end()) { const std::vector<size_t>& indices = cIt->second; - for (std::vector<size_t>::const_iterator indexIt = indices.begin(); - indexIt != indices.end(); ++indexIt) { - const std::string& setupTestName = tests[*indexIt].Name; + for (size_t index : indices) { + const std::string& setupTestName = tests[index].Name; if (std::find(p.Depends.begin(), p.Depends.end(), setupTestName) == p.Depends.end()) { p.Depends.push_back(setupTestName); @@ -1129,9 +1091,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const void cmCTestTestHandler::UpdateMaxTestNameWidth() { std::string::size_type max = this->CTest->GetMaxTestNameWidth(); - for (cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); - it != this->TestList.end(); it++) { - cmCTestTestProperties& p = *it; + for (cmCTestTestProperties& p : this->TestList) { if (max < p.Name.size()) { max = p.Name.size(); } @@ -1269,9 +1229,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed, srand(static_cast<unsigned>(time(nullptr))); } - for (ListOfTests::iterator it = this->TestList.begin(); - it != this->TestList.end(); ++it) { - cmCTestTestProperties& p = *it; + for (cmCTestTestProperties& p : this->TestList) { cmCTestMultiProcessHandler::TestSet depends; if (randomSchedule) { @@ -1283,19 +1241,17 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed, } if (!p.Depends.empty()) { - for (std::vector<std::string>::iterator i = p.Depends.begin(); - i != p.Depends.end(); ++i) { - for (ListOfTests::iterator it2 = this->TestList.begin(); - it2 != this->TestList.end(); ++it2) { - if (it2->Name == *i) { - depends.insert(it2->Index); + for (std::string const& i : p.Depends) { + for (cmCTestTestProperties const& it2 : this->TestList) { + if (it2.Name == i) { + depends.insert(it2.Index); break; // break out of test loop as name can only match 1 } } } } - tests[it->Index] = depends; - properties[it->Index] = &*it; + tests[p.Index] = depends; + properties[p.Index] = &p; } parallel->SetTests(tests, properties); parallel->SetPassFailVectors(&passed, &failed); @@ -1333,21 +1289,18 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.Element("StartDateTime", this->StartTest); xml.Element("StartTestTime", this->StartTestTime); xml.StartElement("TestList"); - cmCTestTestHandler::TestResultsVector::size_type cc; - for (cc = 0; cc < this->TestResults.size(); cc++) { - cmCTestTestResult* result = &this->TestResults[cc]; - std::string testPath = result->Path + "/" + result->Name; + for (cmCTestTestResult const& result : this->TestResults) { + std::string testPath = result.Path + "/" + result.Name; xml.Element("Test", this->CTest->GetShortPathToFile(testPath.c_str())); } xml.EndElement(); // TestList - for (cc = 0; cc < this->TestResults.size(); cc++) { - cmCTestTestResult* result = &this->TestResults[cc]; + for (cmCTestTestResult& result : this->TestResults) { this->WriteTestResultHeader(xml, result); xml.StartElement("Results"); - if (result->Status != cmCTestTestHandler::NOT_RUN) { - if (result->Status != cmCTestTestHandler::COMPLETED || - result->ReturnValue) { + if (result.Status != cmCTestTestHandler::NOT_RUN) { + if (result.Status != cmCTestTestHandler::COMPLETED || + result.ReturnValue) { xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Exit Code"); @@ -1357,24 +1310,24 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Exit Value"); - xml.Element("Value", result->ReturnValue); + xml.Element("Value", result.ReturnValue); xml.EndElement(); // NamedMeasurement } - this->GenerateRegressionImages(xml, result->DartString); + this->GenerateRegressionImages(xml, result.DartString); xml.StartElement("NamedMeasurement"); xml.Attribute("type", "numeric/double"); xml.Attribute("name", "Execution Time"); - xml.Element("Value", result->ExecutionTime); + xml.Element("Value", result.ExecutionTime); xml.EndElement(); // NamedMeasurement - if (!result->Reason.empty()) { + if (!result.Reason.empty()) { const char* reasonType = "Pass Reason"; - if (result->Status != cmCTestTestHandler::COMPLETED) { + if (result.Status != cmCTestTestHandler::COMPLETED) { reasonType = "Fail Reason"; } xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", reasonType); - xml.Element("Value", result->Reason); + xml.Element("Value", result.Reason); xml.EndElement(); // NamedMeasurement } } @@ -1382,36 +1335,34 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.StartElement("NamedMeasurement"); xml.Attribute("type", "numeric/double"); xml.Attribute("name", "Processors"); - xml.Element("Value", result->Properties->Processors); + xml.Element("Value", result.Properties->Processors); xml.EndElement(); // NamedMeasurement xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Completion Status"); - xml.Element("Value", result->CompletionStatus); + xml.Element("Value", result.CompletionStatus); xml.EndElement(); // NamedMeasurement xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Command Line"); - xml.Element("Value", result->FullCommandLine); + xml.Element("Value", result.FullCommandLine); xml.EndElement(); // NamedMeasurement - std::map<std::string, std::string>::iterator measureIt; - for (measureIt = result->Properties->Measurements.begin(); - measureIt != result->Properties->Measurements.end(); ++measureIt) { + for (auto const& measure : result.Properties->Measurements) { xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); - xml.Attribute("name", measureIt->first); - xml.Element("Value", measureIt->second); + xml.Attribute("name", measure.first); + xml.Element("Value", measure.second); xml.EndElement(); // NamedMeasurement } xml.StartElement("Measurement"); xml.StartElement("Value"); - if (result->CompressOutput) { + if (result.CompressOutput) { xml.Attribute("encoding", "base64"); xml.Attribute("compression", "gzip"); } - xml.Content(result->Output); + xml.Content(result.Output); xml.EndElement(); // Value xml.EndElement(); // Measurement xml.EndElement(); // Results @@ -1429,32 +1380,31 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) } void cmCTestTestHandler::WriteTestResultHeader(cmXMLWriter& xml, - cmCTestTestResult* result) + cmCTestTestResult const& result) { xml.StartElement("Test"); - if (result->Status == cmCTestTestHandler::COMPLETED) { + if (result.Status == cmCTestTestHandler::COMPLETED) { xml.Attribute("Status", "passed"); - } else if (result->Status == cmCTestTestHandler::NOT_RUN) { + } else if (result.Status == cmCTestTestHandler::NOT_RUN) { xml.Attribute("Status", "notrun"); } else { xml.Attribute("Status", "failed"); } - std::string testPath = result->Path + "/" + result->Name; - xml.Element("Name", result->Name); - xml.Element("Path", this->CTest->GetShortPathToFile(result->Path.c_str())); + std::string testPath = result.Path + "/" + result.Name; + xml.Element("Name", result.Name); + xml.Element("Path", this->CTest->GetShortPathToFile(result.Path.c_str())); xml.Element("FullName", this->CTest->GetShortPathToFile(testPath.c_str())); - xml.Element("FullCommandLine", result->FullCommandLine); + xml.Element("FullCommandLine", result.FullCommandLine); } void cmCTestTestHandler::WriteTestResultFooter(cmXMLWriter& xml, - cmCTestTestResult* result) + cmCTestTestResult const& result) { - if (!result->Properties->Labels.empty()) { + if (!result.Properties->Labels.empty()) { xml.StartElement("Labels"); - std::vector<std::string> const& labels = result->Properties->Labels; - for (std::vector<std::string>::const_iterator li = labels.begin(); - li != labels.end(); ++li) { - xml.Element("Label", *li); + std::vector<std::string> const& labels = result.Properties->Labels; + for (std::string const& label : labels) { + xml.Element("Label", label); } xml.EndElement(); // Labels } @@ -1463,20 +1413,18 @@ void cmCTestTestHandler::WriteTestResultFooter(cmXMLWriter& xml, } void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml, - cmCTestTestResult* result) + cmCTestTestResult& result) { - if (result->Status != cmCTestTestHandler::COMPLETED && - !result->Properties->AttachOnFail.empty()) { - result->Properties->AttachedFiles.insert( - result->Properties->AttachedFiles.end(), - result->Properties->AttachOnFail.begin(), - result->Properties->AttachOnFail.end()); - } - for (std::vector<std::string>::const_iterator file = - result->Properties->AttachedFiles.begin(); - file != result->Properties->AttachedFiles.end(); ++file) { - const std::string& base64 = this->CTest->Base64GzipEncodeFile(*file); - std::string fname = cmSystemTools::GetFilenameName(*file); + if (result.Status != cmCTestTestHandler::COMPLETED && + !result.Properties->AttachOnFail.empty()) { + result.Properties->AttachedFiles.insert( + result.Properties->AttachedFiles.end(), + result.Properties->AttachOnFail.begin(), + result.Properties->AttachOnFail.end()); + } + for (std::string const& file : result.Properties->AttachedFiles) { + const std::string& base64 = this->CTest->Base64GzipEncodeFile(file); + std::string const fname = cmSystemTools::GetFilenameName(file); xml.StartElement("NamedMeasurement"); xml.Attribute("name", "Attached File"); xml.Attribute("encoding", "base64"); @@ -1490,18 +1438,16 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml, int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec) { - std::vector<std::string>::iterator it; - for (it = vec.begin(); it != vec.end(); ++it) { + for (std::string const& it : vec) { int retVal = 0; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run command: " << *it << std::endl, this->Quiet); - if (!cmSystemTools::RunSingleCommand(it->c_str(), nullptr, nullptr, - &retVal, nullptr, - cmSystemTools::OUTPUT_MERGE + "Run command: " << it << std::endl, this->Quiet); + if (!cmSystemTools::RunSingleCommand(it.c_str(), nullptr, nullptr, &retVal, + nullptr, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Problem running command: " << *it << std::endl); + "Problem running command: " << it << std::endl); return 0; } } @@ -1612,11 +1558,9 @@ std::string cmCTestTestHandler::FindExecutable( // if extraPaths are provided and we were not passed a full path, try them, // try any extra paths if (filepath.empty()) { - for (unsigned int i = 0; i < extraPaths.size(); ++i) { - std::string filepathExtra = - cmSystemTools::GetFilenamePath(extraPaths[i]); - std::string filenameExtra = - cmSystemTools::GetFilenameName(extraPaths[i]); + for (std::string const& extraPath : extraPaths) { + std::string filepathExtra = cmSystemTools::GetFilenamePath(extraPath); + std::string filenameExtra = cmSystemTools::GetFilenameName(extraPath); cmCTestTestHandler::AddConfigurations(ctest, attempted, attemptedConfigs, filepathExtra, filenameExtra); } @@ -1661,9 +1605,8 @@ std::string cmCTestTestHandler::FindExecutable( cmCTestLog(ctest, HANDLER_OUTPUT, "Could not find executable " << testCommand << "\n" << "Looked in the following places:\n"); - for (std::vector<std::string>::iterator i = failed.begin(); - i != failed.end(); ++i) { - cmCTestLog(ctest, HANDLER_OUTPUT, *i << "\n"); + for (std::string const& f : failed) { + cmCTestLog(ctest, HANDLER_OUTPUT, f << "\n"); } } @@ -1757,19 +1700,19 @@ void cmCTestTestHandler::UseExcludeRegExp() this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag; } -const char* cmCTestTestHandler::GetTestStatus(const cmCTestTestResult* result) +const char* cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result) { static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT", "ILLEGAL", "INTERRUPT", "NUMERICAL", "OTHER_FAULT", "Failed", "BAD_COMMAND", "Completed" }; - int status = result->Status; + int status = result.Status; if (status < cmCTestTestHandler::NOT_RUN || status > cmCTestTestHandler::COMPLETED) { return "No Status"; } if (status == cmCTestTestHandler::OTHER_FAULT) { - return result->ExceptionStatus.c_str(); + return result.ExceptionStatus.c_str(); } return statuses[status]; } @@ -2153,125 +2096,117 @@ bool cmCTestTestHandler::SetTestsProperties( break; } std::string val = *it; - std::vector<std::string>::const_iterator tit; - for (tit = tests.begin(); tit != tests.end(); ++tit) { - cmCTestTestHandler::ListOfTests::iterator rtit; - for (rtit = this->TestList.begin(); rtit != this->TestList.end(); - ++rtit) { - if (*tit == rtit->Name) { + for (std::string const& t : tests) { + for (cmCTestTestProperties& rt : this->TestList) { + if (t == rt.Name) { if (key == "WILL_FAIL") { - rtit->WillFail = cmSystemTools::IsOn(val.c_str()); + rt.WillFail = cmSystemTools::IsOn(val.c_str()); } if (key == "DISABLED") { - rtit->Disabled = cmSystemTools::IsOn(val.c_str()); + rt.Disabled = cmSystemTools::IsOn(val.c_str()); } if (key == "ATTACHED_FILES") { - cmSystemTools::ExpandListArgument(val, rtit->AttachedFiles); + cmSystemTools::ExpandListArgument(val, rt.AttachedFiles); } if (key == "ATTACHED_FILES_ON_FAIL") { - cmSystemTools::ExpandListArgument(val, rtit->AttachOnFail); + cmSystemTools::ExpandListArgument(val, rt.AttachOnFail); } if (key == "RESOURCE_LOCK") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - rtit->LockedResources.insert(lval.begin(), lval.end()); + rt.LockedResources.insert(lval.begin(), lval.end()); } if (key == "FIXTURES_SETUP") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - rtit->FixturesSetup.insert(lval.begin(), lval.end()); + rt.FixturesSetup.insert(lval.begin(), lval.end()); } if (key == "FIXTURES_CLEANUP") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - rtit->FixturesCleanup.insert(lval.begin(), lval.end()); + rt.FixturesCleanup.insert(lval.begin(), lval.end()); } if (key == "FIXTURES_REQUIRED") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - rtit->FixturesRequired.insert(lval.begin(), lval.end()); + rt.FixturesRequired.insert(lval.begin(), lval.end()); } if (key == "TIMEOUT") { - rtit->Timeout = atof(val.c_str()); - rtit->ExplicitTimeout = true; + rt.Timeout = atof(val.c_str()); + rt.ExplicitTimeout = true; } if (key == "COST") { - rtit->Cost = static_cast<float>(atof(val.c_str())); + rt.Cost = static_cast<float>(atof(val.c_str())); } if (key == "REQUIRED_FILES") { - cmSystemTools::ExpandListArgument(val, rtit->RequiredFiles); + cmSystemTools::ExpandListArgument(val, rt.RequiredFiles); } if (key == "RUN_SERIAL") { - rtit->RunSerial = cmSystemTools::IsOn(val.c_str()); + rt.RunSerial = cmSystemTools::IsOn(val.c_str()); } if (key == "FAIL_REGULAR_EXPRESSION") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - std::vector<std::string>::iterator crit; - for (crit = lval.begin(); crit != lval.end(); ++crit) { - rtit->ErrorRegularExpressions.push_back( + for (std::string const& cr : lval) { + rt.ErrorRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( - cmsys::RegularExpression(crit->c_str()), - std::string(*crit))); + cmsys::RegularExpression(cr.c_str()), std::string(cr))); } } if (key == "PROCESSORS") { - rtit->Processors = atoi(val.c_str()); - if (rtit->Processors < 1) { - rtit->Processors = 1; + rt.Processors = atoi(val.c_str()); + if (rt.Processors < 1) { + rt.Processors = 1; } } if (key == "SKIP_RETURN_CODE") { - rtit->SkipReturnCode = atoi(val.c_str()); - if (rtit->SkipReturnCode < 0 || rtit->SkipReturnCode > 255) { - rtit->SkipReturnCode = -1; + rt.SkipReturnCode = atoi(val.c_str()); + if (rt.SkipReturnCode < 0 || rt.SkipReturnCode > 255) { + rt.SkipReturnCode = -1; } } if (key == "DEPENDS") { - cmSystemTools::ExpandListArgument(val, rtit->Depends); + cmSystemTools::ExpandListArgument(val, rt.Depends); } if (key == "ENVIRONMENT") { - cmSystemTools::ExpandListArgument(val, rtit->Environment); + cmSystemTools::ExpandListArgument(val, rt.Environment); } if (key == "LABELS") { std::vector<std::string> Labels; cmSystemTools::ExpandListArgument(val, Labels); - rtit->Labels.insert(rtit->Labels.end(), Labels.begin(), - Labels.end()); + rt.Labels.insert(rt.Labels.end(), Labels.begin(), Labels.end()); // sort the array - std::sort(rtit->Labels.begin(), rtit->Labels.end()); + std::sort(rt.Labels.begin(), rt.Labels.end()); // remove duplicates std::vector<std::string>::iterator new_end = - std::unique(rtit->Labels.begin(), rtit->Labels.end()); - rtit->Labels.erase(new_end, rtit->Labels.end()); + std::unique(rt.Labels.begin(), rt.Labels.end()); + rt.Labels.erase(new_end, rt.Labels.end()); } if (key == "MEASUREMENT") { size_t pos = val.find_first_of('='); if (pos != std::string::npos) { std::string mKey = val.substr(0, pos); const char* mVal = val.c_str() + pos + 1; - rtit->Measurements[mKey] = mVal; + rt.Measurements[mKey] = mVal; } else { - rtit->Measurements[val] = "1"; + rt.Measurements[val] = "1"; } } if (key == "PASS_REGULAR_EXPRESSION") { std::vector<std::string> lval; cmSystemTools::ExpandListArgument(val, lval); - std::vector<std::string>::iterator crit; - for (crit = lval.begin(); crit != lval.end(); ++crit) { - rtit->RequiredRegularExpressions.push_back( + for (std::string const& cr : lval) { + rt.RequiredRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( - cmsys::RegularExpression(crit->c_str()), - std::string(*crit))); + cmsys::RegularExpression(cr.c_str()), std::string(cr))); } } if (key == "WORKING_DIRECTORY") { - rtit->Directory = val; + rt.Directory = val; } if (key == "TIMEOUT_AFTER_MATCH") { std::vector<std::string> propArgs; @@ -2281,15 +2216,13 @@ bool cmCTestTestHandler::SetTestsProperties( "TIMEOUT_AFTER_MATCH expects two arguments, found " << propArgs.size() << std::endl); } else { - rtit->AlternateTimeout = atof(propArgs[0].c_str()); + rt.AlternateTimeout = atof(propArgs[0].c_str()); std::vector<std::string> lval; cmSystemTools::ExpandListArgument(propArgs[1], lval); - std::vector<std::string>::iterator crit; - for (crit = lval.begin(); crit != lval.end(); ++crit) { - rtit->TimeoutRegularExpressions.push_back( + for (std::string const& cr : lval) { + rt.TimeoutRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( - cmsys::RegularExpression(crit->c_str()), - std::string(*crit))); + cmsys::RegularExpression(cr.c_str()), std::string(cr))); } } } @@ -2325,22 +2258,21 @@ bool cmCTestTestHandler::SetDirectoryProperties( break; } std::string val = *it; - cmCTestTestHandler::ListOfTests::iterator rtit; - for (rtit = this->TestList.begin(); rtit != this->TestList.end(); ++rtit) { + for (cmCTestTestProperties& rt : this->TestList) { std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - if (cwd == rtit->Directory) { + if (cwd == rt.Directory) { if (key == "LABELS") { std::vector<std::string> DirectoryLabels; cmSystemTools::ExpandListArgument(val, DirectoryLabels); - rtit->Labels.insert(rtit->Labels.end(), DirectoryLabels.begin(), - DirectoryLabels.end()); + rt.Labels.insert(rt.Labels.end(), DirectoryLabels.begin(), + DirectoryLabels.end()); // sort the array - std::sort(rtit->Labels.begin(), rtit->Labels.end()); + std::sort(rt.Labels.begin(), rt.Labels.end()); // remove duplicates std::vector<std::string>::iterator new_end = - std::unique(rtit->Labels.begin(), rtit->Labels.end()); - rtit->Labels.erase(new_end, rtit->Labels.end()); + std::unique(rt.Labels.begin(), rt.Labels.end()); + rt.Labels.erase(new_end, rt.Labels.end()); } } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 4c5b55f..394d20e 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -36,7 +36,7 @@ public: /** * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; /** * When both -R and -I are used should te resulting test list be the @@ -54,7 +54,7 @@ public: /** * This method is called when reading CTest custom file */ - void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; + void PopulateCustomVectors(cmMakefile* mf) override; ///! Control the use of the regular expresisons, call these methods to turn /// them on @@ -95,7 +95,7 @@ public: */ bool SetDirectoryProperties(const std::vector<std::string>& args); - void Initialize() CM_OVERRIDE; + void Initialize() override; // NOTE: This struct is Saved/Restored // in cmCTestTestHandler, if you add to this class @@ -188,10 +188,12 @@ protected: virtual void GenerateTestCommand(std::vector<std::string>& args, int test); int ExecuteCommands(std::vector<std::string>& vec); - void WriteTestResultHeader(cmXMLWriter& xml, cmCTestTestResult* result); - void WriteTestResultFooter(cmXMLWriter& xml, cmCTestTestResult* result); + void WriteTestResultHeader(cmXMLWriter& xml, + cmCTestTestResult const& result); + void WriteTestResultFooter(cmXMLWriter& xml, + cmCTestTestResult const& result); // Write attached test files into the xml - void AttachFiles(cmXMLWriter& xml, cmCTestTestResult* result); + void AttachFiles(cmXMLWriter& xml, cmCTestTestResult& result); //! Clean test output to specified length bool CleanTestOutput(std::string& output, size_t length); @@ -269,7 +271,7 @@ private: */ std::string FindTheExecutable(const char* exe); - const char* GetTestStatus(const cmCTestTestResult*); + const char* GetTestStatus(cmCTestTestResult const&); void ExpandTestsToRunInformation(size_t numPossibleTests); void ExpandTestsToRunInformationForRerunFailed(); diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index ac8e85c..3b2f3e1 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestUpdateCommand* ni = new cmCTestUpdateCommand; ni->CTest = this->CTest; @@ -36,10 +36,10 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_update"; } + std::string GetName() const override { return "ctest_update"; } protected: - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; }; #endif diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 5e7237c..0f51d3f 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -23,7 +23,7 @@ public: /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; cmCTestUpdateHandler(); @@ -42,7 +42,7 @@ public: /** * Initialize handler */ - void Initialize() CM_OVERRIDE; + void Initialize() override; private: // Some structures needed for update diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index e8e882f..61bf1cc 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmCTestUploadCommand* ni = new cmCTestUploadCommand; ni->CTest = this->CTest; @@ -38,15 +38,15 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - std::string GetName() const CM_OVERRIDE { return "ctest_upload"; } + std::string GetName() const override { return "ctest_upload"; } typedef cmCTestHandlerCommand Superclass; protected: - cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; + cmCTestGenericHandler* InitializeHandler() override; - bool CheckArgumentKeyword(std::string const& arg) CM_OVERRIDE; - bool CheckArgumentValue(std::string const& arg) CM_OVERRIDE; + bool CheckArgumentKeyword(std::string const& arg) override; + bool CheckArgumentValue(std::string const& arg) override; enum { diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index 05a3984..59a5de4 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -7,7 +7,6 @@ #include "cmXMLWriter.h" #include <ostream> -#include <set> #include <string> cmCTestUploadHandler::cmCTestUploadHandler() @@ -37,7 +36,6 @@ int cmCTestUploadHandler::ProcessHandler() } std::string buildname = cmCTest::SafeBuildIdField(this->CTest->GetCTestConfiguration("BuildName")); - cmCTest::SetOfStrings::const_iterator it; cmXMLWriter xml(ofs); xml.StartDocument(); @@ -55,14 +53,14 @@ int cmCTestUploadHandler::ProcessHandler() this->CTest->AddSiteProperties(xml); xml.StartElement("Upload"); - for (it = this->Files.begin(); it != this->Files.end(); it++) { + for (std::string const& file : this->Files) { cmCTestOptionalLog(this->CTest, OUTPUT, - "\tUpload file: " << *it << std::endl, this->Quiet); + "\tUpload file: " << file << std::endl, this->Quiet); xml.StartElement("File"); - xml.Attribute("filename", *it); + xml.Attribute("filename", file); xml.StartElement("Content"); xml.Attribute("encoding", "base64"); - xml.Content(this->CTest->Base64EncodeFile(*it)); + xml.Content(this->CTest->Base64EncodeFile(file)); xml.EndElement(); // Content xml.EndElement(); // File } diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h index 3dc9c10..ff50574 100644 --- a/Source/CTest/cmCTestUploadHandler.h +++ b/Source/CTest/cmCTestUploadHandler.h @@ -20,14 +20,14 @@ public: typedef cmCTestGenericHandler Superclass; cmCTestUploadHandler(); - ~cmCTestUploadHandler() CM_OVERRIDE {} + ~cmCTestUploadHandler() override {} /* * The main entry point for this class */ - int ProcessHandler() CM_OVERRIDE; + int ProcessHandler() override; - void Initialize() CM_OVERRIDE; + void Initialize() override; /** Specify a set of files to submit. */ void SetFiles(cmCTest::SetOfStrings const& files); diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 186d2d4..7e09ef0 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -56,9 +56,8 @@ bool cmCTestVC::InitialCheckout(const char* command) // Construct the initial checkout command line. std::vector<std::string> args = cmSystemTools::ParseArguments(command); std::vector<char const*> vc_co; - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - vc_co.push_back(ai->c_str()); + for (std::string const& arg : args) { + vc_co.push_back(arg.c_str()); } vc_co.push_back(nullptr); diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index 83a7b75..308e6f7 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -112,17 +112,15 @@ cmParseBlanketJSCoverage::cmParseBlanketJSCoverage( bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files) { - size_t i = 0; - std::string path; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found " << files.size() << " Files" << std::endl, this->Coverage.Quiet); - for (i = 0; i < files.size(); i++) { + for (std::string const& file : files) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Reading JSON File " << files[i] << std::endl, + "Reading JSON File " << file << std::endl, this->Coverage.Quiet); - if (!this->ReadJSONFile(files[i])) { + if (!this->ReadJSONFile(file)) { return false; } } diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 629010c..bf03c45 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -53,10 +53,8 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles() while (ci != this->Coverage.TotalCoverage.end()) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v = ci->second; bool nothing = true; - for (cmCTestCoverageHandlerContainer::SingleFileCoverageVector::iterator - i = v.begin(); - i != v.end(); ++i) { - if (*i > 0) { + for (int i : v) { + if (i > 0) { nothing = false; break; } diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h index 7b0442a..081f5fa 100644 --- a/Source/CTest/cmParseCacheCoverage.h +++ b/Source/CTest/cmParseCacheCoverage.h @@ -26,7 +26,7 @@ public: protected: // implement virtual from parent - bool LoadCoverageData(const char* dir) CM_OVERRIDE; + bool LoadCoverageData(const char* dir) override; // remove files with no coverage void RemoveUnCoveredFiles(); // Read a single mcov file diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 4a16a48..9407935 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -24,10 +24,10 @@ public: this->CurFileName = ""; } - ~XMLParser() CM_OVERRIDE {} + ~XMLParser() override {} protected: - void EndElement(const std::string& name) CM_OVERRIDE + void EndElement(const std::string& name) override { if (name == "source") { this->InSource = false; @@ -38,7 +38,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) CM_OVERRIDE + void CharacterDataHandler(const char* data, int length) override { std::string tmp; tmp.insert(0, data, length); @@ -50,7 +50,7 @@ protected: } } - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { std::string FoundSource; std::string finalpath; @@ -71,8 +71,8 @@ protected: // Check if this is an absolute path that falls within our // source or binary directories. - for (size_t i = 0; i < FilePaths.size(); i++) { - if (filename.find(FilePaths[i]) == 0) { + for (std::string const& filePath : FilePaths) { + if (filename.find(filePath) == 0) { this->CurFileName = filename; break; } @@ -81,8 +81,8 @@ protected: if (this->CurFileName == "") { // Check if this is a path that is relative to our source or // binary directories. - for (size_t i = 0; i < FilePaths.size(); i++) { - finalpath = FilePaths[i] + "/" + filename; + for (std::string const& filePath : FilePaths) { + finalpath = filePath + "/" + filename; if (cmSystemTools::FileExists(finalpath.c_str())) { this->CurFileName = finalpath; break; diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h index 81766f9..13afbbc 100644 --- a/Source/CTest/cmParseGTMCoverage.h +++ b/Source/CTest/cmParseGTMCoverage.h @@ -25,7 +25,7 @@ public: protected: // implement virtual from parent - bool LoadCoverageData(const char* dir) CM_OVERRIDE; + bool LoadCoverageData(const char* dir) override; // Read a single mcov file bool ReadMCovFile(const char* f); // find out what line in a mumps file (filepath) the given entry point diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 6d884ef..a2c20ec 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,12 +23,12 @@ public: this->PackageName = ""; } - ~XMLParser() CM_OVERRIDE {} + ~XMLParser() override {} protected: - void EndElement(const std::string& /*name*/) CM_OVERRIDE {} + void EndElement(const std::string& /*name*/) override {} - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& name, const char** atts) override { if (name == "package") { this->PackageName = atts[1]; @@ -119,9 +119,8 @@ protected: } // Check if any of the locations found match our package. - for (std::vector<std::string>::const_iterator fi = files.begin(); - fi != files.end(); ++fi) { - std::string dir = cmsys::SystemTools::GetParentDirectory(*fi); + for (std::string const& f : files) { + std::string dir = cmsys::SystemTools::GetParentDirectory(f); if (cmsys::SystemTools::StringEndsWith(dir, this->PackageName.c_str())) { cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found package directory for " << fileName << ": " diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 8cb1170..1419743 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -9,7 +9,6 @@ #include <map> #include <string> #include <utility> -#include <vector> cmParseMumpsCoverage::cmParseMumpsCoverage( cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) @@ -112,14 +111,12 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) std::string pat = d; pat += "/*.m"; glob.FindFiles(pat); - std::vector<std::string>& files = glob.GetFiles(); - std::vector<std::string>::iterator fileIt; - for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) { - std::string name = cmSystemTools::GetFilenameName(*fileIt); - this->RoutineToDirectory[name.substr(0, name.size() - 2)] = *fileIt; + for (std::string& file : glob.GetFiles()) { + std::string name = cmSystemTools::GetFilenameName(file); + this->RoutineToDirectory[name.substr(0, name.size() - 2)] = file; // initialze each file, this is left out until CDash is fixed // to handle large numbers of files - this->InitializeMumpsFile(*fileIt); + this->InitializeMumpsFile(file); } return true; } diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 5ada25d..f3c191b 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -40,9 +40,8 @@ bool cmProcess::StartProcess() // put the command as arg0 this->ProcessArgs.push_back(this->Command.c_str()); // now put the command arguments in - for (std::vector<std::string>::iterator i = this->Arguments.begin(); - i != this->Arguments.end(); ++i) { - this->ProcessArgs.push_back(i->c_str()); + for (std::string const& arg : this->Arguments) { + this->ProcessArgs.push_back(arg.c_str()); } this->ProcessArgs.push_back(nullptr); // null terminate the list this->Process = cmsysProcess_New(); diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 7f2b8a0..ab80f5b 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -51,5 +51,4 @@ cm_check_cxx_feature(make_unique) if(CMake_HAVE_CXX_MAKE_UNIQUE) set(CMake_HAVE_CXX_UNIQUE_PTR 1) endif() -cm_check_cxx_feature(override) cm_check_cxx_feature(unique_ptr) diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx deleted file mode 100644 index 5a33fbb..0000000 --- a/Source/Checks/cm_cxx_override.cxx +++ /dev/null @@ -1,24 +0,0 @@ -struct Foo -{ - Foo() {} - virtual ~Foo() {} - virtual int test() const = 0; -}; - -struct Bar : Foo -{ - Bar() {} - ~Bar() override {} - int test() const override { return 0; } -}; - -int test(Foo const& foo) -{ - return foo.test(); -} - -int main() -{ - Bar const bar; - return test(bar); -} diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index bd565cd..cdb9478 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -21,7 +21,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; // Description: // Set/Get the value (on/off). diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index b0c270c..c509ae7 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -21,7 +21,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; }; #endif // cmCursesDummyWidget_h diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index 79ae241..aab559b 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -19,13 +19,13 @@ class cmCursesLabelWidget : public cmCursesWidget public: cmCursesLabelWidget(int width, int height, int left, int top, const std::string& name); - ~cmCursesLabelWidget() CM_OVERRIDE; + ~cmCursesLabelWidget() override; // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled - bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; }; #endif // cmCursesLabelWidget_h diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 099c722..2bcc15a 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -18,16 +18,16 @@ class cmCursesLongMessageForm : public cmCursesForm public: cmCursesLongMessageForm(std::vector<std::string> const& messages, const char* title); - ~cmCursesLongMessageForm() CM_OVERRIDE; + ~cmCursesLongMessageForm() override; // Description: // Handle user input. - void HandleInput() CM_OVERRIDE; + void HandleInput() override; // Description: // Display form. Use a window of size width x height, starting // at top, left. - void Render(int left, int top, int width, int height) CM_OVERRIDE; + void Render(int left, int top, int width, int height) override; // Description: // This method should normally called only by the form. @@ -37,7 +37,7 @@ public: // Description: // This method should normally called only by the form. // The only exception is during a resize. - void UpdateStatusBar() CM_OVERRIDE; + void UpdateStatusBar() override; protected: std::string Messages; diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 96dd5c0..7f5b3ca 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -27,7 +27,7 @@ class cmCursesMainForm : public cmCursesForm public: cmCursesMainForm(std::vector<std::string> const& args, int initwidth); - ~cmCursesMainForm() CM_OVERRIDE; + ~cmCursesMainForm() override; /** * Set the widgets which represent the cache entries. @@ -37,13 +37,13 @@ public: /** * Handle user input. */ - void HandleInput() CM_OVERRIDE; + void HandleInput() override; /** * Display form. Use a window of size width x height, starting * at top, left. */ - void Render(int left, int top, int width, int height) CM_OVERRIDE; + void Render(int left, int top, int width, int height) override; /** * Returns true if an entry with the given key is in the @@ -64,7 +64,7 @@ public: * exception is during a resize. The optional argument specifies the * string to be displayed in the status bar. */ - void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(nullptr); } + void UpdateStatusBar() override { this->UpdateStatusBar(nullptr); } virtual void UpdateStatusBar(const char* message); /** @@ -80,7 +80,7 @@ public: * During a CMake run, an error handle should add errors * to be displayed afterwards. */ - void AddError(const char* message, const char* title) CM_OVERRIDE; + void AddError(const char* message, const char* title) override; /** * Used to do a configure. If argument is specified, it does only the check diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index 86a6946..3e50e2d 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -24,7 +24,7 @@ public: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was // handled. - bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; void SetOption(const std::string&); void AddOption(std::string const&); void NextOption(); diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h index 6a72402..bfa0ea3 100644 --- a/Source/CursesDialog/cmCursesPathWidget.h +++ b/Source/CursesDialog/cmCursesPathWidget.h @@ -23,9 +23,9 @@ public: * This method is called when different keys are pressed. The * subclass can have a special implementation handler for this. */ - void OnTab(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; - void OnReturn(cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; - void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + void OnTab(cmCursesMainForm* fm, WINDOW* w) override; + void OnReturn(cmCursesMainForm* fm, WINDOW* w) override; + void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) override; protected: std::string LastString; diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index 5787098..90310f6 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -30,14 +30,14 @@ public: * when this widget has focus. Returns true if the input was * handled. */ - bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE; + bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; /** * Set/Get the string. */ void SetString(const std::string& value); const char* GetString(); - const char* GetValue() CM_OVERRIDE; + const char* GetValue() override; /** * Set/Get InEdit flag. Can be used to tell the widget to leave @@ -59,7 +59,7 @@ public: * in the toolbar and return true. Otherwise, return false * and the parent widget will print. */ - bool PrintKeys() CM_OVERRIDE; + bool PrintKeys() override; protected: // true if the widget is in edit mode diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index c6b007d..1b3fb15 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -23,7 +23,7 @@ public: } protected: - bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE + bool filterAcceptsRow(int row, const QModelIndex& p) const override { QStringList strs; const QAbstractItemModel* m = this->sourceModel(); @@ -77,7 +77,7 @@ public: protected: bool ShowAdvanced; - bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE + bool filterAcceptsRow(int row, const QModelIndex& p) const override { const QAbstractItemModel* m = this->sourceModel(); QModelIndex idx = m->index(row, 0, p); diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index 7eac314..3d53d09 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -18,14 +18,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddCompileOptionsCommand; } + cmCommand* Clone() override { return new cmAddCompileOptionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 95c58d9..6af4f10 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomCommandCommand; } + cmCommand* Clone() override { return new cmAddCustomCommandCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: bool CheckOutputs(const std::vector<std::string>& outputs); diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 8d9d09f..1a55116 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddCustomTargetCommand; } + cmCommand* Clone() override { return new cmAddCustomTargetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index a58d430..7b75638 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddDefinitionsCommand; } + cmCommand* Clone() override { return new cmAddDefinitionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 10f3c57..e10df71 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddDependenciesCommand; } + cmCommand* Clone() override { return new cmAddDependenciesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 570b35f..bdf607d 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddExecutableCommand; } + cmCommand* Clone() override { return new cmAddExecutableCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 1656312..aa21261 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddLibraryCommand; } + cmCommand* Clone() override { return new cmAddLibraryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index a6c92a8..0ea4423 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddSubDirectoryCommand; } + cmCommand* Clone() override { return new cmAddSubDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index a296904..bea3f3d 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAddTestCommand; } + cmCommand* Clone() override { return new cmAddTestCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool HandleNameMode(std::vector<std::string> const& args); diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index ea22855..3742e3e 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmAuxSourceDirectoryCommand; } + cmCommand* Clone() override { return new cmAuxSourceDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index c0a5e11..3b18567 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmBreakCommand; } + cmCommand* Clone() override { return new cmBreakCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 17e9636..e0529a4 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmBuildCommand; } + cmCommand* Clone() override { return new cmBuildCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * The primary command signature with optional, KEYWORD-based args. diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index e3d2f2a..4bb72d1 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmBuildNameCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; } + cmCommand* Clone() override { return new cmBuildNameCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index b3c05d4..bfff8f1 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { return new cmCMakeHostSystemInformationCommand; } @@ -38,7 +38,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool GetValue(cmsys::SystemInformation& info, std::string const& key, diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 4a979de..18d9460 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmCMakeMinimumRequired; } + cmCommand* Clone() override { return new cmCMakeMinimumRequired; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: std::vector<std::string> UnknownArguments; diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index f9c51c3..b18576c 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmCMakePolicyCommand; } + cmCommand* Clone() override { return new cmCMakePolicyCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool HandleSetMode(std::vector<std::string> const& args); diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index c5885f2..e580e04 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -29,7 +29,7 @@ public: protected: void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) CM_OVERRIDE; + Indent indent) override; cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index a164b37..1325fd3 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -330,10 +330,8 @@ cmCTest::cmCTest() this->TestingHandlers["submit"] = new cmCTestSubmitHandler; this->TestingHandlers["upload"] = new cmCTestUploadHandler; - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); - ++it) { - it->second->SetCTestInstance(this); + for (auto& handler : this->TestingHandlers) { + handler.second->SetCTestInstance(this); } // Make sure we can capture the build tool output. @@ -979,9 +977,11 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, output = ""; cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:"); - std::vector<const char*>::iterator ait; - for (ait = argv.begin(); ait != argv.end() && *ait; ++ait) { - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\""); + for (char const* arg : argv) { + if (!arg) { + break; + } + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, " \"" << arg << "\""); } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, std::endl); @@ -1365,12 +1365,10 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml) void cmCTest::GenerateSubprojectsOutput(cmXMLWriter& xml) { - std::vector<std::string> subprojects = this->GetLabelsForSubprojects(); - std::vector<std::string>::const_iterator i; - for (i = subprojects.begin(); i != subprojects.end(); ++i) { + for (std::string const& subproj : this->GetLabelsForSubprojects()) { xml.StartElement("Subproject"); - xml.Attribute("name", *i); - xml.Element("Label", *i); + xml.Attribute("name", subproj); + xml.Element("Label", subproj); xml.EndElement(); // Subproject } } @@ -1403,7 +1401,6 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, { std::string buildname = cmCTest::SafeBuildIdField(this->GetCTestConfiguration("BuildName")); - cmCTest::VectorOfStrings::const_iterator it; xml.StartDocument(); xml.ProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" " @@ -1419,15 +1416,15 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, this->AddSiteProperties(xml); xml.StartElement("Notes"); - for (it = files.begin(); it != files.end(); it++) { - cmCTestLog(this, OUTPUT, "\tAdd file: " << *it << std::endl); + for (cmsys::String const& file : files) { + cmCTestLog(this, OUTPUT, "\tAdd file: " << file << std::endl); std::string note_time = this->CurrentTime(); xml.StartElement("Note"); - xml.Attribute("Name", *it); + xml.Attribute("Name", file); xml.Element("Time", cmSystemTools::GetTime()); xml.Element("DateTime", note_time); xml.StartElement("Text"); - cmsys::ifstream ifs(it->c_str()); + cmsys::ifstream ifs(file.c_str()); if (ifs) { std::string line; while (cmSystemTools::GetLineFromStream(ifs, line)) { @@ -1436,9 +1433,9 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, } ifs.close(); } else { - xml.Content("Problem reading file: " + *it + "\n"); + xml.Content("Problem reading file: " + file + "\n"); cmCTestLog(this, ERROR_MESSAGE, "Problem reading file: " - << *it << " while creating notes" << std::endl); + << file << " while creating notes" << std::endl); } xml.EndElement(); // Text xml.EndElement(); // Note @@ -1520,14 +1517,13 @@ std::string cmCTest::Base64EncodeFile(std::string const& file) bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files) { - VectorOfStrings::const_iterator it; - for (it = files.begin(); it != files.end(); ++it) { - if (!cmSystemTools::FileExists(it->c_str())) { + for (cmsys::String const& file : files) { + if (!cmSystemTools::FileExists(file.c_str())) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " - << *it << " to submit." << std::endl;); + << file << " to submit." << std::endl;); return false; } - this->AddSubmitFile(PartExtraFiles, it->c_str()); + this->AddSubmitFile(PartExtraFiles, file.c_str()); } return true; } @@ -2101,10 +2097,8 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // pass the argument to all the handlers as well, but i may no longer be // set to what it was originally so I'm not sure this is working as // intended - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); - ++it) { - if (!it->second->ProcessCommandLineArguments(arg, i, args)) { + for (auto& handler : this->TestingHandlers) { + if (!handler.second->ProcessCommandLineArguments(arg, i, args)) { cmCTestLog(this, ERROR_MESSAGE, "Problem parsing command line arguments within a handler"); return 0; @@ -2201,11 +2195,9 @@ int cmCTest::ExecuteTests() if (this->ExtraVerbose) { cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl); } - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); - ++it) { - it->second->SetVerbose(this->ExtraVerbose); - it->second->SetSubmitIndex(this->SubmitIndex); + for (auto& handler : this->TestingHandlers) { + handler.second->SetVerbose(this->ExtraVerbose); + handler.second->SetSubmitIndex(this->SubmitIndex); } this->GetHandler("script")->SetVerbose(this->Verbose); res = this->GetHandler("script")->ProcessHandler(); @@ -2219,11 +2211,9 @@ int cmCTest::ExecuteTests() // and Verbose is always on in this case this->ExtraVerbose = this->Verbose; this->Verbose = true; - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); - ++it) { - it->second->SetVerbose(this->Verbose); - it->second->SetSubmitIndex(this->SubmitIndex); + for (auto& handler : this->TestingHandlers) { + handler.second->SetVerbose(this->Verbose); + handler.second->SetSubmitIndex(this->SubmitIndex); } std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); if (!this->Initialize(cwd.c_str(), nullptr)) { @@ -2324,13 +2314,11 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) } if (found) { - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); - ++it) { - cmCTestLog(this, DEBUG, - "* Read custom CTest configuration vectors for handler: " - << it->first << " (" << it->second << ")" << std::endl); - it->second->PopulateCustomVectors(mf); + for (auto& handler : this->TestingHandlers) { + cmCTestLog( + this, DEBUG, "* Read custom CTest configuration vectors for handler: " + << handler.first << " (" << handler.second << ")" << std::endl); + handler.second->PopulateCustomVectors(mf); } } diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index 56d88e9..d3f102c 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -103,8 +103,8 @@ private: unsigned int DataStart; const char* Ignore; cmCAStringVector(); - bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; - void DoReset() CM_OVERRIDE; + bool DoConsume(const std::string& arg, unsigned int index) override; + void DoReset() override; }; /** cmCAString is to be used for arguments which consist of one value, @@ -121,8 +121,8 @@ public: private: std::string String; unsigned int DataStart; - bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; - void DoReset() CM_OVERRIDE; + bool DoConsume(const std::string& arg, unsigned int index) override; + void DoReset() override; cmCAString(); }; @@ -138,8 +138,8 @@ public: bool IsEnabled() const { return this->Enabled; } private: bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; - void DoReset() CM_OVERRIDE; + bool DoConsume(const std::string& arg, unsigned int index) override; + void DoReset() override; cmCAEnabler(); }; @@ -155,8 +155,8 @@ public: bool IsEnabled() const { return this->Enabled; } private: bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) CM_OVERRIDE; - void DoReset() CM_OVERRIDE; + bool DoConsume(const std::string& arg, unsigned int index) override; + void DoReset() override; cmCADisabler(); }; diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index e91471c..9d11fff 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -25,7 +25,6 @@ #cmakedefine CMake_HAVE_CXX_GNU_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE -#cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_UNIQUE_PTR #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" @@ -46,12 +45,6 @@ #define CM_FALLTHROUGH #endif -#ifdef CMake_HAVE_CXX_OVERRIDE -#define CM_OVERRIDE override -#else -#define CM_OVERRIDE -#endif - #define CM_DISABLE_COPY(Class) \ Class(Class const&) CM_EQ_DELETE; \ Class& operator=(Class const&) CM_EQ_DELETE; diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 54ca0bf..cff934b 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -16,14 +16,14 @@ class cmExecutionStatus; class cmConfigureFileCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmConfigureFileCommand; } + cmCommand* Clone() override { return new cmConfigureFileCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: int ConfigureFile(); diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h index 51f991d..d383d1d 100644 --- a/Source/cmContinueCommand.h +++ b/Source/cmContinueCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmContinueCommand; } + cmCommand* Clone() override { return new cmContinueCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 47fb610..005b32c 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmCreateTestSourceList; } + cmCommand* Clone() override { return new cmCreateTestSourceList; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 43f6c58..a9c1856 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmDefinePropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmDefinePropertyCommand; } + cmCommand* Clone() override { return new cmDefinePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: std::string PropertyName; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 7780ccf..2f76f62 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -33,13 +33,13 @@ public: const std::map<std::string, DependencyVector>* validDeps); /** Virtual destructor to cleanup subclasses properly. */ - ~cmDependsC() CM_OVERRIDE; + ~cmDependsC() override; protected: // Implement writing/checking methods required by superclass. bool WriteDependencies(const std::set<std::string>& sources, const std::string& obj, std::ostream& makeDepends, - std::ostream& internalDepends) CM_OVERRIDE; + std::ostream& internalDepends) override; // Method to scan a single file. void Scan(std::istream& is, const char* directory, diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 42879f1..ccf267b 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -35,7 +35,7 @@ public: cmDependsFortran(cmLocalGenerator* lg); /** Virtual destructor to cleanup subclasses properly. */ - ~cmDependsFortran() CM_OVERRIDE; + ~cmDependsFortran() override; /** Callback from build system after a .mod file has been generated by a Fortran90 compiler to copy the .mod file to the @@ -50,7 +50,7 @@ public: protected: // Finalize the dependency information for the target. bool Finalize(std::ostream& makeDepends, - std::ostream& internalDepends) CM_OVERRIDE; + std::ostream& internalDepends) override; // Find all the modules required by the target. void LocateModules(); @@ -62,7 +62,7 @@ protected: // Implement writing/checking methods required by superclass. bool WriteDependencies(const std::set<std::string>& sources, const std::string& file, std::ostream& makeDepends, - std::ostream& internalDepends) CM_OVERRIDE; + std::ostream& internalDepends) override; // Actually write the depenencies to the streams. bool WriteDependenciesReal(const char* obj, cmFortranSourceInfo const& info, diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 4fd5960..d070840 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -25,16 +25,16 @@ public: cmDependsJava(); /** Virtual destructor to cleanup subclasses properly. */ - ~cmDependsJava() CM_OVERRIDE; + ~cmDependsJava() override; protected: // Implement writing/checking methods required by superclass. bool WriteDependencies(const std::set<std::string>& sources, const std::string& file, std::ostream& makeDepends, - std::ostream& internalDepends) CM_OVERRIDE; + std::ostream& internalDepends) override; bool CheckDependencies( std::istream& internalDepends, const char* internalDependsFileName, - std::map<std::string, DependencyVector>& validDeps) CM_OVERRIDE; + std::map<std::string, DependencyVector>& validDeps) override; }; #endif diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h index d5bb79a..d85c00f 100644 --- a/Source/cmDisallowedCommand.h +++ b/Source/cmDisallowedCommand.h @@ -24,23 +24,20 @@ public: { } - ~cmDisallowedCommand() CM_OVERRIDE { delete this->Command; } + ~cmDisallowedCommand() override { delete this->Command; } - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { return new cmDisallowedCommand(this->Command->Clone(), this->Policy, this->Message); } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; - void FinalPass() CM_OVERRIDE { this->Command->FinalPass(); } + void FinalPass() override { this->Command->FinalPass(); } - bool HasFinalPass() const CM_OVERRIDE - { - return this->Command->HasFinalPass(); - } + bool HasFinalPass() const override { return this->Command->HasFinalPass(); } private: cmCommand* Command; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 62d875c..2d6d8f9 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -235,23 +235,23 @@ public: ByteOrderType order); // Return the number of sections as specified by the ELF header. - unsigned int GetNumberOfSections() const CM_OVERRIDE + unsigned int GetNumberOfSections() const override { return static_cast<unsigned int>(this->ELFHeader.e_shnum); } // Get the file position of a dynamic section entry. - unsigned long GetDynamicEntryPosition(int j) CM_OVERRIDE; + unsigned long GetDynamicEntryPosition(int j) override; - cmELF::DynamicEntryList GetDynamicEntries() CM_OVERRIDE; - std::vector<char> EncodeDynamicEntries(const cmELF::DynamicEntryList&) - CM_OVERRIDE; + cmELF::DynamicEntryList GetDynamicEntries() override; + std::vector<char> EncodeDynamicEntries( + const cmELF::DynamicEntryList&) override; // Lookup a string from the dynamic section with the given tag. - StringEntry const* GetDynamicSectionString(unsigned int tag) CM_OVERRIDE; + StringEntry const* GetDynamicSectionString(unsigned int tag) override; // Print information about the ELF file. - void PrintInfo(std::ostream& os) const CM_OVERRIDE + void PrintInfo(std::ostream& os) const override { os << "ELF " << Types::GetName(); if (this->ByteOrder == ByteOrderMSB) { diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 2b8cc24..97645a9 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -26,14 +26,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmEnableLanguageCommand; } + cmCommand* Clone() override { return new cmEnableLanguageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index 1743b25..88a17b9 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -31,14 +31,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmEnableTestingCommand; } + cmCommand* Clone() override { return new cmEnableTestingCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; }; #endif diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index e3d696e..dc5da74 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmExecProgramCommand; } + cmCommand* Clone() override { return new cmExecProgramCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: static bool RunCommand(const char* command, std::string& output, int& retVal, diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index dcf7b1c..b415deb 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmExecuteProcessCommand; } + cmCommand* Clone() override { return new cmExecuteProcessCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index db386f0..c80839b 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -42,25 +42,24 @@ public: protected: // Implement virtual methods from the superclass. - void GeneratePolicyHeaderCode(std::ostream&) CM_OVERRIDE {} - void GeneratePolicyFooterCode(std::ostream&) CM_OVERRIDE {} + void GeneratePolicyHeaderCode(std::ostream&) override {} + void GeneratePolicyFooterCode(std::ostream&) override {} void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = "") CM_OVERRIDE; - void GenerateImportFooterCode(std::ostream& os) CM_OVERRIDE; + const std::string& config = "") override; + void GenerateImportFooterCode(std::ostream& os) override; void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target) CM_OVERRIDE; + const cmGeneratorTarget* target) override; void GenerateExpectedTargetsCode( - std::ostream& os, const std::string& expectedTargets) CM_OVERRIDE; - void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties) - CM_OVERRIDE; + std::ostream& os, const std::string& expectedTargets) override; + void GenerateImportPropertyCode( + std::ostream& os, const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties) override; void GenerateMissingTargetsCheckCode( - std::ostream& os, - const std::vector<std::string>& missingTargets) CM_OVERRIDE; + std::ostream& os, const std::vector<std::string>& missingTargets) override; void GenerateInterfaceProperties( cmGeneratorTarget const* target, std::ostream& os, - const ImportPropertyMap& properties) CM_OVERRIDE; + const ImportPropertyMap& properties) override; }; #endif diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index d509453..6457a77 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -49,14 +49,14 @@ public: protected: // Implement virtual methods from the superclass. - bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; + bool GenerateMainFile(std::ostream& os) override; void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, - std::vector<std::string>& missingTargets) CM_OVERRIDE; + std::vector<std::string>& missingTargets) override; void HandleMissingTarget(std::string& link_libs, std::vector<std::string>& missingTargets, cmGeneratorTarget* depender, - cmGeneratorTarget* dependee) CM_OVERRIDE; + cmGeneratorTarget* dependee) override; void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, @@ -69,7 +69,7 @@ protected: ImportPropertyMap& properties); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config) CM_OVERRIDE; + const std::string& config) override; std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, const std::string& name); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 7b6ad11..a5c6751 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmExportCommand; } + cmCommand* Clone() override { return new cmExportCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: cmCommandArgumentsHelper Helper; diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index bb43513..3165982 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -36,37 +36,36 @@ public: protected: // Implement virtual methods from the superclass. - void GeneratePolicyHeaderCode(std::ostream&) CM_OVERRIDE {} - void GeneratePolicyFooterCode(std::ostream&) CM_OVERRIDE {} + void GeneratePolicyHeaderCode(std::ostream&) override {} + void GeneratePolicyFooterCode(std::ostream&) override {} void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = "") CM_OVERRIDE; - void GenerateImportFooterCode(std::ostream& os) CM_OVERRIDE; + const std::string& config = "") override; + void GenerateImportFooterCode(std::ostream& os) override; void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target) CM_OVERRIDE; + const cmGeneratorTarget* target) override; void GenerateExpectedTargetsCode( - std::ostream& os, const std::string& expectedTargets) CM_OVERRIDE; - void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties) - CM_OVERRIDE; + std::ostream& os, const std::string& expectedTargets) override; + void GenerateImportPropertyCode( + std::ostream& os, const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties) override; void GenerateMissingTargetsCheckCode( - std::ostream& os, - const std::vector<std::string>& missingTargets) CM_OVERRIDE; + std::ostream& os, const std::vector<std::string>& missingTargets) override; void GenerateInterfaceProperties( cmGeneratorTarget const* target, std::ostream& os, - const ImportPropertyMap& properties) CM_OVERRIDE; - void GenerateImportPrefix(std::ostream& os) CM_OVERRIDE; - void LoadConfigFiles(std::ostream&) CM_OVERRIDE; + const ImportPropertyMap& properties) override; + void GenerateImportPrefix(std::ostream& os) override; + void LoadConfigFiles(std::ostream&) override; void GenerateRequiredCMakeVersion(std::ostream& os, - const char* versionString) CM_OVERRIDE; - void CleanupTemporaryVariables(std::ostream&) CM_OVERRIDE; - void GenerateImportedFileCheckLoop(std::ostream& os) CM_OVERRIDE; + const char* versionString) override; + void CleanupTemporaryVariables(std::ostream&) override; + void GenerateImportedFileCheckLoop(std::ostream& os) override; void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, - const std::set<std::string>& importedLocations) CM_OVERRIDE; + const std::set<std::string>& importedLocations) override; bool GenerateImportFileConfig(const std::string& config, - std::vector<std::string>&) CM_OVERRIDE; + std::vector<std::string>&) override; }; #endif diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index e535873..cda8433 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -53,16 +53,16 @@ public: protected: // Implement virtual methods from the superclass. - bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; + bool GenerateMainFile(std::ostream& os) override; void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, - std::vector<std::string>& missingTargets) CM_OVERRIDE; + std::vector<std::string>& missingTargets) override; void HandleMissingTarget(std::string& link_libs, std::vector<std::string>& missingTargets, cmGeneratorTarget* depender, - cmGeneratorTarget* dependee) CM_OVERRIDE; + cmGeneratorTarget* dependee) override; - void ReplaceInstallPrefix(std::string& input) CM_OVERRIDE; + void ReplaceInstallPrefix(std::string& input) override; void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, @@ -91,7 +91,7 @@ protected: std::set<std::string>& importedLocations); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config) CM_OVERRIDE; + const std::string& config) override; cmInstallExportGenerator* IEGen; diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 286a3e0..bf5e9bc 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -15,15 +15,15 @@ class cmExecutionStatus; class cmExportLibraryDependenciesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { return new cmExportLibraryDependenciesCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; - void FinalPass() CM_OVERRIDE; - bool HasFinalPass() const CM_OVERRIDE { return true; } + void FinalPass() override; + bool HasFinalPass() const override { return true; } private: std::string Filename; diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 9f6ac03..70c3857 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -27,15 +27,15 @@ public: void SetConfig(const std::string& config) { this->Config = config; } protected: // Implement virtual methods from the superclass. - bool GenerateMainFile(std::ostream& os) CM_OVERRIDE; + bool GenerateMainFile(std::ostream& os) override; void GenerateImportTargetsConfig(std::ostream&, const std::string&, std::string const&, - std::vector<std::string>&) CM_OVERRIDE + std::vector<std::string>&) override { } void HandleMissingTarget(std::string&, std::vector<std::string>&, - cmGeneratorTarget*, cmGeneratorTarget*) CM_OVERRIDE + cmGeneratorTarget*, cmGeneratorTarget*) override { } @@ -44,7 +44,7 @@ protected: std::set<const cmGeneratorTarget*>& emitted); std::string InstallNameDir(cmGeneratorTarget* target, - const std::string& config) CM_OVERRIDE; + const std::string& config) override; private: std::string FindTargets(const std::string& prop, diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 6b89037..a1734ee 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -99,7 +99,7 @@ public: } cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator() - const CM_OVERRIDE + const override { T* p = new T; p->SetName(GetName()); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 48d07ad..9c9b75b 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -235,7 +235,14 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // We don't want paths with CMakeFiles in them // or do we? // In speedcrunch those where purely internal + // + // Also we can disable external (outside the project) files by setting ON + // CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable. + const bool excludeExternal = + cmSystemTools::IsOn(it.second[0]->GetMakefile()->GetSafeDefinition( + "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES")); if (!splitted.empty() && + (!excludeExternal || (relative.find("..") == std::string::npos)) && relative.find("CMakeFiles") == std::string::npos) { tree.InsertPath(splitted, 1, fileName); } @@ -380,6 +387,19 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( std::string const& fullPath = s->GetFullPath(); + // Check file position relative to project root dir. + const std::string& relative = cmSystemTools::RelativePath( + (*lg).GetSourceDirectory(), fullPath.c_str()); + // Do not add this file if it has ".." in relative path and + // if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on. + const bool excludeExternal = + cmSystemTools::IsOn((*lg).GetMakefile()->GetSafeDefinition( + "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES")); + if (excludeExternal && + (relative.find("..") != std::string::npos)) { + continue; + } + if (isCFile) { cFiles.push_back(fullPath); } diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 9397733..be3af25 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -25,7 +25,7 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); - void Generate() CM_OVERRIDE; + void Generate() override; private: struct CbpUnit diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 549802e..029054f 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -60,7 +60,7 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); - void Generate() CM_OVERRIDE; + void Generate() override; void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs); void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs, diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 5d2ca10..5136660 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -35,9 +35,9 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, - bool optional) CM_OVERRIDE; + bool optional) override; - void Generate() CM_OVERRIDE; + void Generate() override; private: // create .project file in the source tree diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 7e80314..9716fe7 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -22,7 +22,7 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); - void Generate() CM_OVERRIDE; + void Generate() override; private: void CreateKateProjectFile(const cmLocalGenerator* lg) const; diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 58fcd22..7fb304e 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -27,7 +27,7 @@ public: typedef std::map<std::string, std::vector<std::string>> MapSourceFileFlags; cmExtraSublimeTextGenerator(); - void Generate() CM_OVERRIDE; + void Generate() override; private: void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs); diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index 64c29f8..044755e 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFLTKWrapUICommand; } + cmCommand* Clone() override { return new cmFLTKWrapUICommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * This is called at the end after all the information @@ -40,8 +40,8 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - void FinalPass() CM_OVERRIDE; - bool HasFinalPass() const CM_OVERRIDE { return true; } + void FinalPass() override; + bool HasFinalPass() const override { return true; } private: /** diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4eb74cc..35ebb47 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1706,7 +1706,7 @@ struct cmFileInstaller : public cmFileCopier this->Manifest = this->Makefile->GetSafeDefinition("CMAKE_INSTALL_MANIFEST_FILES"); } - ~cmFileInstaller() CM_OVERRIDE + ~cmFileInstaller() override { // Save the updated install manifest. this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES", @@ -1731,12 +1731,12 @@ protected: this->Manifest += file.substr(this->DestDirLength); } - std::string const& ToName(std::string const& fromName) CM_OVERRIDE + std::string const& ToName(std::string const& fromName) override { return this->Rename.empty() ? fromName : this->Rename; } - void ReportCopy(const char* toFile, Type type, bool copy) CM_OVERRIDE + void ReportCopy(const char* toFile, Type type, bool copy) override { if (!this->MessageNever && (copy || !this->MessageLazy)) { std::string message = (copy ? "Installing: " : "Up-to-date: "); @@ -1748,11 +1748,11 @@ protected: this->ManifestAppend(toFile); } } - bool ReportMissing(const char* fromFile) CM_OVERRIDE + bool ReportMissing(const char* fromFile) override { return (this->Optional || this->cmFileCopier::ReportMissing(fromFile)); } - bool Install(const char* fromFile, const char* toFile) CM_OVERRIDE + bool Install(const char* fromFile, const char* toFile) override { // Support installing from empty source to make a directory. if (this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { @@ -1761,16 +1761,16 @@ protected: return this->cmFileCopier::Install(fromFile, toFile); } - bool Parse(std::vector<std::string> const& args) CM_OVERRIDE; + bool Parse(std::vector<std::string> const& args) override; enum { DoingType = DoingLast1, DoingRename, DoingLast2 }; - bool CheckKeyword(std::string const& arg) CM_OVERRIDE; - bool CheckValue(std::string const& arg) CM_OVERRIDE; - void DefaultFilePermissions() CM_OVERRIDE + bool CheckKeyword(std::string const& arg) override; + bool CheckValue(std::string const& arg) override; + void DefaultFilePermissions() override { this->cmFileCopier::DefaultFilePermissions(); // Add execute permissions based on the target type. diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 1de8b59..17269f3 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -22,14 +22,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFileCommand; } + cmCommand* Clone() override { return new cmFileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: bool HandleRename(std::vector<std::string> const& args); diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 32542f0..b237f1b 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -25,7 +25,7 @@ class cmFindCommon : public cmCommand { public: cmFindCommon(); - ~cmFindCommon() CM_OVERRIDE; + ~cmFindCommon() override; protected: friend class cmSearchPath; diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 88c2372..4309449 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -24,7 +24,7 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; } + cmCommand* Clone() override { return new cmFindFileCommand; } }; #endif diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index fb0a44f..fb8a700 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFindLibraryCommand; } + cmCommand* Clone() override { return new cmFindLibraryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: void AddArchitecturePaths(const char* suffix); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9b79931..cd55e89 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1662,7 +1662,7 @@ public: } private: - bool Visit(std::string const& fullPath) CM_OVERRIDE + bool Visit(std::string const& fullPath) override { if (this->UseSuffixes) { return this->FPC->SearchDirectory(fullPath); @@ -1710,12 +1710,12 @@ public: private: std::string String; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { std::string fullPath = parent + this->String; return this->Consider(fullPath, lister); } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorFixed(*this)); @@ -1739,7 +1739,7 @@ public: private: std::vector<std::string> const& Vector; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { for (std::string const& i : this->Vector) { if (this->Consider(parent + i, lister)) { @@ -1748,7 +1748,7 @@ private: } return false; } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorEnumerate(*this)); @@ -1788,7 +1788,7 @@ protected: private: std::vector<std::string> const& Names; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { // Construct a list of matches. std::vector<std::string> matches; @@ -1820,7 +1820,7 @@ private: } return false; } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorProject(*this)); @@ -1848,7 +1848,7 @@ public: private: std::vector<std::string> const& Names; std::string Extension; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { // Construct a list of matches. std::vector<std::string> matches; @@ -1874,7 +1874,7 @@ private: } return false; } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorMacProject(*this)); @@ -1899,7 +1899,7 @@ public: private: std::string String; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { // Look for matching files. std::vector<std::string> matches; @@ -1918,7 +1918,7 @@ private: } return false; } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorCaseInsensitive(*this)); @@ -1942,7 +1942,7 @@ public: private: std::string Pattern; - bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE + bool Search(std::string const& parent, cmFileList& lister) override { // Glob the set of matching files. std::string expr = parent; @@ -1963,7 +1963,7 @@ private: } return false; } - CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override { CM_AUTO_PTR<cmFileListGeneratorBase> g(new cmFileListGeneratorGlob(*this)); return g; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 69deb13..150a51d 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -51,14 +51,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFindPackageCommand; } + cmCommand* Clone() override { return new cmFindPackageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: class PathLabel : public cmFindCommon::PathLabel diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 5b9ddf8..cb0db4c 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFindPathCommand; } + cmCommand* Clone() override { return new cmFindPathCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; bool IncludeFileInPath; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index f4d78b4..147936c 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -28,14 +28,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFindProgramCommand; } + cmCommand* Clone() override { return new cmFindProgramCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: std::string FindProgram(); diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 6787023..5131a4f 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -19,10 +19,10 @@ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: cmForEachFunctionBlocker(cmMakefile* mf); - ~cmForEachFunctionBlocker() CM_OVERRIDE; + ~cmForEachFunctionBlocker() override; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; - bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; + cmExecutionStatus&) override; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override; std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; @@ -39,14 +39,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmForEachCommand; } + cmCommand* Clone() override { return new cmForEachCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool HandleInMode(std::vector<std::string> const& args); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 74230b0..774df84 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -18,12 +18,12 @@ public: cmFunctionHelperCommand() {} ///! clean up any memory allocated by the function - ~cmFunctionHelperCommand() CM_OVERRIDE {} + ~cmFunctionHelperCommand() override {} /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmFunctionHelperCommand* newC = new cmFunctionHelperCommand; // we must copy when we clone @@ -39,10 +39,10 @@ public: * the CMakeLists.txt file. */ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE + cmExecutionStatus&) override { return false; } diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 48d6b36..3352b92 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -19,10 +19,10 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: cmFunctionFunctionBlocker() { this->Depth = 0; } - ~cmFunctionFunctionBlocker() CM_OVERRIDE {} + ~cmFunctionFunctionBlocker() override {} bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; - bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE; + cmExecutionStatus&) override; + bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; @@ -36,14 +36,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmFunctionCommand; } + cmCommand* Clone() override { return new cmFunctionCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index 5144772..a96f38f 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -94,7 +94,7 @@ public: * file was successfully written before allowing the original to be * replaced. */ - ~cmGeneratedFileStream() CM_OVERRIDE; + ~cmGeneratedFileStream() override; /** * Open an output file by name. This should be used only with a diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index cdf89d7..92dac79 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -42,12 +42,12 @@ struct TextContent : public cmGeneratorExpressionEvaluator } std::string Evaluate(cmGeneratorExpressionContext*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker*) const override { return std::string(this->Content, this->Length); } - Type GetType() const CM_OVERRIDE + Type GetType() const override { return cmGeneratorExpressionEvaluator::Text; } @@ -77,17 +77,17 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator this->ParamChildren = parameters; } - Type GetType() const CM_OVERRIDE + Type GetType() const override { return cmGeneratorExpressionEvaluator::Generator; } std::string Evaluate(cmGeneratorExpressionContext* context, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE; + cmGeneratorExpressionDAGChecker*) const override; std::string GetOriginalExpression() const; - ~GeneratorExpressionContent() CM_OVERRIDE; + ~GeneratorExpressionContent() override; private: std::string EvaluateParameters(const cmGeneratorExpressionNode* node, diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 0f6170f..8f32410 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -57,15 +57,15 @@ static const struct ZeroNode : public cmGeneratorExpressionNode { ZeroNode() {} - bool GeneratesContent() const CM_OVERRIDE { return false; } + bool GeneratesContent() const override { return false; } - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return std::string(); } @@ -75,13 +75,13 @@ static const struct OneNode : public cmGeneratorExpressionNode { OneNode() {} - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return parameters.front(); } @@ -128,11 +128,11 @@ static const struct NotNode : public cmGeneratorExpressionNode { NotNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { if (*parameters.begin() != "0" && *parameters.begin() != "1") { reportError( @@ -148,13 +148,13 @@ static const struct BoolNode : public cmGeneratorExpressionNode { BoolNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 1; } + int NumExpectedParameters() const override { return 1; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; } @@ -164,12 +164,12 @@ static const struct IfNode : public cmGeneratorExpressionNode { IfNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 3; } + int NumExpectedParameters() const override { return 3; } std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker*) const override { if (parameters[0] != "1" && parameters[0] != "0") { reportError(context, content->GetOriginalExpression(), @@ -185,13 +185,13 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode { StrEqualNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return *parameters.begin() == parameters[1] ? "1" : "0"; } @@ -201,13 +201,13 @@ static const struct EqualNode : public cmGeneratorExpressionNode { EqualNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { char* pEnd; @@ -279,13 +279,13 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::LowerCase(parameters.front()); } @@ -295,13 +295,13 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode { UpperCaseNode() {} - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::UpperCase(parameters.front()); } @@ -311,13 +311,13 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::MakeCidentifier(parameters.front()); } @@ -327,13 +327,13 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode { Angle_RNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 0; } + int NumExpectedParameters() const override { return 0; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return ">"; } @@ -343,13 +343,13 @@ static const struct CommaNode : public cmGeneratorExpressionNode { CommaNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 0; } + int NumExpectedParameters() const override { return 0; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return ","; } @@ -359,13 +359,13 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode { SemicolonNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 0; } + int NumExpectedParameters() const override { return 0; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return ";"; } @@ -375,7 +375,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { CompilerIdNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, @@ -427,11 +427,11 @@ static const struct CCompilerIdNode : public CompilerIdNode { CCompilerIdNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!context->HeadTarget) { reportError( @@ -449,11 +449,11 @@ static const struct CXXCompilerIdNode : public CompilerIdNode { CXXCompilerIdNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!context->HeadTarget) { reportError( @@ -471,7 +471,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode { CompilerVersionNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, @@ -508,11 +508,11 @@ static const struct CCompilerVersionNode : public CompilerVersionNode { CCompilerVersionNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!context->HeadTarget) { reportError( @@ -530,11 +530,11 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode { CxxCompilerVersionNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!context->HeadTarget) { reportError( @@ -552,13 +552,13 @@ struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return OneOrZeroParameters; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { const char* platformId = context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME"); @@ -581,13 +581,13 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode { VersionGreaterNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, parameters.front().c_str(), @@ -601,13 +601,13 @@ static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode { VersionGreaterEqNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, parameters.front().c_str(), @@ -621,13 +621,13 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode { VersionLessNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, parameters.front().c_str(), @@ -641,13 +641,13 @@ static const struct VersionLessEqNode : public cmGeneratorExpressionNode { VersionLessEqNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS_EQUAL, parameters.front().c_str(), @@ -661,13 +661,13 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode { VersionEqualNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, parameters.front().c_str(), @@ -681,11 +681,11 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode { LinkOnlyNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!dagChecker) { reportError(context, content->GetOriginalExpression(), @@ -703,13 +703,13 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode { ConfigurationNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 0; } + int NumExpectedParameters() const override { return 0; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { context->HadContextSensitiveCondition = true; return context->Config; @@ -720,13 +720,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return OneOrZeroParameters; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { if (parameters.empty()) { return configurationNode.Evaluate(parameters, context, content, nullptr); @@ -779,15 +779,15 @@ static const struct JoinNode : public cmGeneratorExpressionNode { JoinNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 2; } + int NumExpectedParameters() const override { return 2; } - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { std::vector<std::string> list; cmSystemTools::ExpandListArgument(parameters.front(), list); @@ -799,13 +799,13 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode { CompileLanguageNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return OneOrZeroParameters; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { if (context->Language.empty()) { reportError( @@ -903,13 +903,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode TargetPropertyNode() {} // This node handles errors on parameter count itself. - int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } + int NumExpectedParameters() const override { return OneOrMoreParameters; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagCheckerParent) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagCheckerParent) const override { if (parameters.size() != 1 && parameters.size() != 2) { reportError( @@ -1196,21 +1196,21 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode { TargetNameNode() {} - bool GeneratesContent() const CM_OVERRIDE { return true; } + bool GeneratesContent() const override { return true; } - bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } - bool RequiresLiteralInput() const CM_OVERRIDE { return true; } + bool AcceptsArbitraryContentParameter() const override { return true; } + bool RequiresLiteralInput() const override { return true; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { return parameters.front(); } - int NumExpectedParameters() const CM_OVERRIDE { return 1; } + int NumExpectedParameters() const override { return 1; } } targetNameNode; @@ -1218,11 +1218,11 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode { TargetObjectsNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { std::string tgtName = parameters.front(); cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName); @@ -1299,13 +1299,13 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { CompileFeaturesNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } + int NumExpectedParameters() const override { return OneOrMoreParameters; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { cmGeneratorTarget const* target = context->HeadTarget; if (!target) { @@ -1424,13 +1424,13 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode { TargetPolicyNode() {} - int NumExpectedParameters() const CM_OVERRIDE { return 1; } + int NumExpectedParameters() const override { return 1; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { if (!context->HeadTarget) { reportError( @@ -1485,14 +1485,14 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode { InstallPrefixNode() {} - bool GeneratesContent() const CM_OVERRIDE { return true; } - int NumExpectedParameters() const CM_OVERRIDE { return 0; } + bool GeneratesContent() const override { return true; } + int NumExpectedParameters() const override { return 0; } - std::string Evaluate(const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { reportError(context, content->GetOriginalExpression(), "INSTALL_PREFIX is a marker for install(EXPORT) only. It " @@ -1705,13 +1705,13 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} - int NumExpectedParameters() const CM_OVERRIDE { return 1; } + int NumExpectedParameters() const override { return 1; } - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override { // Lookup the referenced target. std::string name = *parameters.begin(); @@ -1787,11 +1787,11 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode { ShellPathNode() {} - std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const - CM_OVERRIDE + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { if (!cmSystemTools::FileIsFullPath(parameters.front())) { reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index 803f051..1f29c78 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmGetCMakePropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmGetCMakePropertyCommand; } + cmCommand* Clone() override { return new cmGetCMakePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index f373bc2..02ea056 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmGetDirectoryPropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmGetDirectoryPropertyCommand; } + cmCommand* Clone() override { return new cmGetDirectoryPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: void StoreResult(const std::string& variable, const char* prop); diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index c23684c..1b358ab 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -60,7 +60,30 @@ bool cmGetFilenameComponentCommand::InitialPass( } } } - cmSystemTools::SplitProgramFromArgs(filename, result, programArgs); + + // First assume the path to the program was specified with no + // arguments and with no quoting or escaping for spaces. + // Only bother doing this if there is non-whitespace. + if (!cmSystemTools::TrimWhitespace(filename).empty()) { + result = cmSystemTools::FindProgram(filename); + } + + // If that failed then assume a command-line string was given + // and split the program part from the rest of the arguments. + if (result.empty()) { + std::string program; + if (cmSystemTools::SplitProgramFromArgs(filename, program, + programArgs)) { + if (cmSystemTools::FileExists(program)) { + result = program; + } else { + result = cmSystemTools::FindProgram(program); + } + } + if (result.empty()) { + programArgs.clear(); + } + } } else if (args[2] == "EXT") { result = cmSystemTools::GetFilenameExtension(filename); } else if (args[2] == "NAME_WE") { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index b7141b2..8c26655 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmGetFilenameComponentCommand; } + cmCommand* Clone() override { return new cmGetFilenameComponentCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index 44a3852..c3f653e 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -17,14 +17,14 @@ class cmGetPropertyCommand : public cmCommand public: cmGetPropertyCommand(); - cmCommand* Clone() CM_OVERRIDE { return new cmGetPropertyCommand; } + cmCommand* Clone() override { return new cmGetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: enum OutType diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index d4fef01..43bc330 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmGetSourceFilePropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmGetSourceFilePropertyCommand; } + cmCommand* Clone() override { return new cmGetSourceFilePropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index e74b7e1..63ee5fd 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmGetTargetPropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmGetTargetPropertyCommand; } + cmCommand* Clone() override { return new cmGetTargetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 5a3ef40..4a74f59 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -15,14 +15,14 @@ class cmExecutionStatus; class cmGetTestPropertyCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmGetTestPropertyCommand; } + cmCommand* Clone() override { return new cmGetTestPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h index 842a7c4..e19118b 100644 --- a/Source/cmGlobalCommonGenerator.h +++ b/Source/cmGlobalCommonGenerator.h @@ -16,7 +16,7 @@ class cmGlobalCommonGenerator : public cmGlobalGenerator { public: cmGlobalCommonGenerator(cmake* cm); - ~cmGlobalCommonGenerator() CM_OVERRIDE; + ~cmGlobalCommonGenerator() override; }; #endif diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 125a9e2..4e3e770 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -45,7 +45,7 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory public: /** Create a GlobalGenerator */ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { if (name != T::GetActualName()) { return nullptr; @@ -54,22 +54,22 @@ public: } /** Get the documentation entry for this factory */ - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { T::GetDocumentation(entry); } /** Get the names of the current registered generators */ - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(T::GetActualName()); } /** Determine whether or not this generator supports toolsets */ - bool SupportsToolset() const CM_OVERRIDE { return T::SupportsToolset(); } + bool SupportsToolset() const override { return T::SupportsToolset(); } /** Determine whether or not this generator supports platforms */ - bool SupportsPlatform() const CM_OVERRIDE { return T::SupportsPlatform(); } + bool SupportsPlatform() const override { return T::SupportsPlatform(); } }; #endif diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 05a3a3c..7d4b2ba 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -57,7 +57,7 @@ public: /* * Determine what program to use for building the project. */ - bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE; + bool FindMakeProgram(cmMakefile* mf) override; cmGeneratedFileStream* GetBuildFileStream() { diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h index fd57782..d6c43f3 100644 --- a/Source/cmGlobalKdevelopGenerator.h +++ b/Source/cmGlobalKdevelopGenerator.h @@ -30,7 +30,7 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); - void Generate() CM_OVERRIDE; + void Generate() override; private: /*** Create the foo.kdevelop.filelist file, return false if it doesn't diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 6eb2124..05ab904 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -27,7 +27,7 @@ public: static std::string GetActualName() { return "NMake Makefiles"; } /** Get encoding used by generator for makefile files */ - codecvt::Encoding GetMakefileEncoding() const CM_OVERRIDE + codecvt::Encoding GetMakefileEncoding() const override { return codecvt::ANSI; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 4a8ebe7..f556ce1 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -78,7 +78,7 @@ public: cmLinkLineComputer* CreateLinkLineComputer( cmOutputConverter* outputConverter, - cmStateDirectory const& stateDir) const CM_OVERRIDE; + cmStateDirectory const& stateDir) const override; /** * Write the given @a comment to the output stream @a os. It @@ -98,7 +98,7 @@ public: */ static bool SupportsPlatform() { return false; } - bool IsIPOSupported() const CM_OVERRIDE { return true; } + bool IsIPOSupported() const override { return true; } /** * Write a build statement to @a os with the @a comment using @@ -183,11 +183,11 @@ public: return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); } - ~cmGlobalNinjaGenerator() CM_OVERRIDE {} + ~cmGlobalNinjaGenerator() override {} - cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE; + cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; - std::string GetName() const CM_OVERRIDE + std::string GetName() const override { return cmGlobalNinjaGenerator::GetActualName(); } @@ -195,12 +195,12 @@ public: static std::string GetActualName() { return "Ninja"; } /** Get encoding used by generator for ninja files */ - codecvt::Encoding GetMakefileEncoding() const CM_OVERRIDE; + codecvt::Encoding GetMakefileEncoding() const override; static void GetDocumentation(cmDocumentationEntry& entry); void EnableLanguage(std::vector<std::string> const& languages, - cmMakefile* mf, bool optional) CM_OVERRIDE; + cmMakefile* mf, bool optional) override; void GenerateBuildCommand(std::vector<std::string>& makeCommand, const std::string& makeProgram, @@ -209,34 +209,31 @@ public: const std::string& targetName, const std::string& config, bool fast, bool verbose, std::vector<std::string> const& makeOptions = - std::vector<std::string>()) CM_OVERRIDE; + std::vector<std::string>()) override; // Setup target names - const char* GetAllTargetName() const CM_OVERRIDE { return "all"; } - const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; } - const char* GetInstallLocalTargetName() const CM_OVERRIDE + const char* GetAllTargetName() const override { return "all"; } + const char* GetInstallTargetName() const override { return "install"; } + const char* GetInstallLocalTargetName() const override { return "install/local"; } - const char* GetInstallStripTargetName() const CM_OVERRIDE + const char* GetInstallStripTargetName() const override { return "install/strip"; } - const char* GetTestTargetName() const CM_OVERRIDE { return "test"; } - const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; } - const char* GetPackageSourceTargetName() const CM_OVERRIDE + const char* GetTestTargetName() const override { return "test"; } + const char* GetPackageTargetName() const override { return "package"; } + const char* GetPackageSourceTargetName() const override { return "package_source"; } - const char* GetEditCacheTargetName() const CM_OVERRIDE - { - return "edit_cache"; - } - const char* GetRebuildCacheTargetName() const CM_OVERRIDE + const char* GetEditCacheTargetName() const override { return "edit_cache"; } + const char* GetRebuildCacheTargetName() const override { return "rebuild_cache"; } - const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; } + const char* GetCleanTargetName() const override { return "clean"; } cmGeneratedFileStream* GetBuildFileStream() const { @@ -340,7 +337,7 @@ public: void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target); - void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3 static std::string RequiredNinjaVersion() { return "1.3"; } @@ -363,16 +360,16 @@ public: std::vector<std::string> const& linked_target_dirs); protected: - void Generate() CM_OVERRIDE; + void Generate() override; - bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; } + bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const override { return true; } private: - std::string GetEditCacheCommand() const CM_OVERRIDE; - bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE; + std::string GetEditCacheCommand() const override; + bool FindMakeProgram(cmMakefile* mf) override; void CheckNinjaFeatures(); bool CheckLanguages(std::vector<std::string> const& languages, - cmMakefile* mf) const CM_OVERRIDE; + cmMakefile* mf) const override; bool CheckFortran(cmMakefile* mf) const; void OpenBuildFileStream(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index bc03c44..d601f88 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -68,7 +68,7 @@ public: } ///! Get the name for the generator. - std::string GetName() const CM_OVERRIDE + std::string GetName() const override { return cmGlobalUnixMakefileGenerator3::GetActualName(); } @@ -89,23 +89,23 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE; + cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, - bool optional) CM_OVERRIDE; + bool optional) override; - void Configure() CM_OVERRIDE; + void Configure() override; /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and * requests that they Generate. */ - void Generate() CM_OVERRIDE; + void Generate() override; void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream, std::vector<cmLocalGenerator*>&); @@ -134,7 +134,7 @@ public: const std::string& targetName, const std::string& config, bool fast, bool verbose, std::vector<std::string> const& makeOptions = - std::vector<std::string>()) CM_OVERRIDE; + std::vector<std::string>()) override; /** Record per-target progress information. */ void RecordTargetProgress(cmMakefileTargetGenerator* tg); @@ -149,9 +149,9 @@ public: /** Does the make tool tolerate .DELETE_ON_ERROR? */ virtual bool AllowDeleteOnError() const { return true; } - bool IsIPOSupported() const CM_OVERRIDE { return true; } + bool IsIPOSupported() const override { return true; } - void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; std::string IncludeDirective; bool DefineWindowsNULL; @@ -178,37 +178,31 @@ protected: bool NeedRequiresStep(cmGeneratorTarget const*); // Target name hooks for superclass. - const char* GetAllTargetName() const CM_OVERRIDE { return "all"; } - const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; } - const char* GetInstallLocalTargetName() const CM_OVERRIDE + const char* GetAllTargetName() const override { return "all"; } + const char* GetInstallTargetName() const override { return "install"; } + const char* GetInstallLocalTargetName() const override { return "install/local"; } - const char* GetInstallStripTargetName() const CM_OVERRIDE + const char* GetInstallStripTargetName() const override { return "install/strip"; } - const char* GetPreinstallTargetName() const CM_OVERRIDE - { - return "preinstall"; - } - const char* GetTestTargetName() const CM_OVERRIDE { return "test"; } - const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; } - const char* GetPackageSourceTargetName() const CM_OVERRIDE + const char* GetPreinstallTargetName() const override { return "preinstall"; } + const char* GetTestTargetName() const override { return "test"; } + const char* GetPackageTargetName() const override { return "package"; } + const char* GetPackageSourceTargetName() const override { return "package_source"; } - const char* GetEditCacheTargetName() const CM_OVERRIDE - { - return "edit_cache"; - } - const char* GetRebuildCacheTargetName() const CM_OVERRIDE + const char* GetEditCacheTargetName() const override { return "edit_cache"; } + const char* GetRebuildCacheTargetName() const override { return "rebuild_cache"; } - const char* GetCleanTargetName() const CM_OVERRIDE { return "clean"; } + const char* GetCleanTargetName() const override { return "clean"; } - bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const CM_OVERRIDE { return true; } + bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const override { return true; } // Some make programs (Borland) do not keep a rule if there are no // dependencies or commands. This is a problem for creating rules @@ -247,13 +241,13 @@ protected: cmGeneratedFileStream* CommandDatabase; private: - const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; } - std::string GetEditCacheCommand() const CM_OVERRIDE; + const char* GetBuildIgnoreErrorsFlag() const override { return "-i"; } + std::string GetEditCacheCommand() const override; std::map<cmStateSnapshot, std::set<cmGeneratorTarget const*>, cmStateSnapshot::StrictWeakOrder> DirectoryTargetsMap; - void InitializeProgressMarks() CM_OVERRIDE; + void InitializeProgressMarks() override; }; #endif diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 5db81ce..392b6e1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -51,7 +51,7 @@ class cmGlobalVisualStudio10Generator::Factory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { std::string genName; const char* p = cmVS10GenName(name, genName); @@ -73,22 +73,22 @@ public: return 0; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs10generatorName) + " [arch]"; entry.Brief = "Generates Visual Studio 2010 project files. " "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs10generatorName); names.push_back(vs10generatorName + std::string(" IA64")); names.push_back(vs10generatorName + std::string(" Win64")); } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 4a5c245..5f80c73 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -98,7 +98,7 @@ public: virtual const char* GetToolsVersion() { return "4.0"; } - bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE; + bool FindMakeProgram(cmMakefile* mf) override; static std::string GetInstalledNsightTegraVersion(); diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index d37d4b0..cb3b047 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -35,7 +35,7 @@ class cmGlobalVisualStudio11Generator::Factory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { std::string genName; const char* p = cmVS11GenName(name, genName); @@ -68,14 +68,14 @@ public: return ret; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs11generatorName) + " [arch]"; entry.Brief = "Generates Visual Studio 2012 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs11generatorName); names.push_back(vs11generatorName + std::string(" ARM")); @@ -89,8 +89,8 @@ public: } } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index de62ff0..a9c605c 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -35,7 +35,7 @@ class cmGlobalVisualStudio12Generator::Factory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { std::string genName; const char* p = cmVS12GenName(name, genName); @@ -57,22 +57,22 @@ public: return 0; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs12generatorName) + " [arch]"; entry.Brief = "Generates Visual Studio 2013 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs12generatorName); names.push_back(vs12generatorName + std::string(" ARM")); names.push_back(vs12generatorName + std::string(" Win64")); } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index d032782..5ba21a6 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -32,7 +32,7 @@ public: virtual const char* GetToolsVersion() { return "12.0"; } protected: bool ProcessGeneratorToolsetField(std::string const& key, - std::string const& value) CM_OVERRIDE; + std::string const& value) override; virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index e2120b8..97d5313 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -35,7 +35,7 @@ class cmGlobalVisualStudio14Generator::Factory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { std::string genName; const char* p = cmVS14GenName(name, genName); @@ -57,22 +57,22 @@ public: return 0; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs14generatorName) + " [arch]"; entry.Brief = "Generates Visual Studio 2015 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs14generatorName); names.push_back(vs14generatorName + std::string(" ARM")); names.push_back(vs14generatorName + std::string(" Win64")); } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index ce1ba00..d2bf7cc 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -69,8 +69,8 @@ public: names.push_back(vs15generatorName + std::string(" Win64")); } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 730784b..e934882 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -28,7 +28,7 @@ public: virtual const char* GetToolsVersion() { return "15.0"; } protected: - bool InitializeWindows(cmMakefile* mf) CM_OVERRIDE; + bool InitializeWindows(cmMakefile* mf) override; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; virtual const char* GetIDEVersion() { return "15.0"; } @@ -44,8 +44,8 @@ protected: // Check for a Win 8 SDK known to the registry or VS installer tool. bool IsWin81SDKInstalled() const; - std::string FindMSBuildCommand() CM_OVERRIDE; - std::string FindDevEnvCommand() CM_OVERRIDE; + std::string FindMSBuildCommand() override; + std::string FindDevEnvCommand() override; private: class Factory; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 624f9e5..3b45c90 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -200,10 +200,16 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( std::string guid = this->GetGUID(name); for (std::vector<std::string>::const_iterator i = configs.begin(); i != configs.end(); ++i) { - const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(*i)); - if (dstConfig == nullptr) { - dstConfig = i->c_str(); + std::vector<std::string> mapConfig; + const char* dstConfig = i->c_str(); + if (target.GetProperty("EXTERNAL_MSPROJECT")) { + if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" + + cmSystemTools::UpperCase(*i))) { + cmSystemTools::ExpandListArgument(m, mapConfig); + if (!mapConfig.empty()) { + dstConfig = mapConfig[0].c_str(); + } + } } fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << dstConfig << "|" << platformName << std::endl; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 788c431..c5aced4 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -91,7 +91,7 @@ public: const char* GetIntelProjectVersion(); - bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE; + bool FindMakeProgram(cmMakefile* mf) override; /** Is the Microsoft Assembler enabled? */ bool IsMasmEnabled() const { return this->MasmEnabled; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 728ad2d..9a08084 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -17,7 +17,7 @@ class cmGlobalVisualStudio8Generator::Factory : public cmGlobalGeneratorFactory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { if (strncmp(name.c_str(), vs8generatorName, sizeof(vs8generatorName) - 1) != 0) { @@ -51,14 +51,14 @@ public: return ret; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs8generatorName) + " [arch]"; entry.Brief = "Deprecated. Generates Visual Studio 2005 project files. " "Optional [arch] can be \"Win64\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs8generatorName); names.push_back(vs8generatorName + std::string(" Win64")); @@ -73,8 +73,8 @@ public: } } - bool SupportsToolset() const CM_OVERRIDE { return false; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return false; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() @@ -354,10 +354,16 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( std::string guid = this->GetGUID(name); for (std::vector<std::string>::const_iterator i = configs.begin(); i != configs.end(); ++i) { - const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(*i)); - if (dstConfig == nullptr) { - dstConfig = i->c_str(); + std::vector<std::string> mapConfig; + const char* dstConfig = i->c_str(); + if (target.GetProperty("EXTERNAL_MSPROJECT")) { + if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" + + cmSystemTools::UpperCase(*i))) { + cmSystemTools::ExpandListArgument(m, mapConfig); + if (!mapConfig.empty()) { + dstConfig = mapConfig[0].c_str(); + } + } } fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".ActiveCfg = " << dstConfig << "|" diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index b1634e2..0abb348 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -14,7 +14,7 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE + cmake* cm) const override { if (strncmp(name.c_str(), vs9generatorName, sizeof(vs9generatorName) - 1) != 0) { @@ -52,14 +52,14 @@ public: return ret; } - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs9generatorName) + " [arch]"; entry.Brief = "Generates Visual Studio 2008 project files. " "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(vs9generatorName); names.push_back(vs9generatorName + std::string(" Win64")); @@ -75,8 +75,8 @@ public: } } - bool SupportsToolset() const CM_OVERRIDE { return false; } - bool SupportsPlatform() const CM_OVERRIDE { return true; } + bool SupportsToolset() const override { return false; } + bool SupportsPlatform() const override { return true; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 399b6e0..62bfd3b 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -118,7 +118,7 @@ public: }; class OrderedTargetDependSet; - bool FindMakeProgram(cmMakefile*) CM_OVERRIDE; + bool FindMakeProgram(cmMakefile*) override; virtual std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const; diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index bd09715..e8b3a73 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -29,7 +29,7 @@ public: return new cmGlobalGeneratorSimpleFactory<cmGlobalWatcomWMakeGenerator>(); } ///! Get the name for the generator. - std::string GetName() const CM_OVERRIDE + std::string GetName() const override { return cmGlobalWatcomWMakeGenerator::GetActualName(); } @@ -43,10 +43,10 @@ public: * extension, pthreads, byte order etc. */ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, - bool optional) CM_OVERRIDE; + bool optional) override; - bool AllowNotParallel() const CM_OVERRIDE { return false; } - bool AllowDeleteOnError() const CM_OVERRIDE { return false; } + bool AllowNotParallel() const override { return false; } + bool AllowDeleteOnError() const override { return false; } }; #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index bfc8d9b..7bc352b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -117,20 +117,20 @@ class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory { public: cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const CM_OVERRIDE; + cmake* cm) const override; - void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE + void GetDocumentation(cmDocumentationEntry& entry) const override { cmGlobalXCodeGenerator::GetDocumentation(entry); } - void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE + void GetGenerators(std::vector<std::string>& names) const override { names.push_back(cmGlobalXCodeGenerator::GetActualName()); } - bool SupportsToolset() const CM_OVERRIDE { return true; } - bool SupportsPlatform() const CM_OVERRIDE { return false; } + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return false; } }; cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 7f57335..81d1bd0 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -37,7 +37,7 @@ public: static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - std::string GetName() const CM_OVERRIDE + std::string GetName() const override { return cmGlobalXCodeGenerator::GetActualName(); } @@ -47,14 +47,14 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) CM_OVERRIDE; + cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. */ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, - bool optional) CM_OVERRIDE; + bool optional) override; /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. @@ -66,42 +66,42 @@ public: const std::string& targetName, const std::string& config, bool fast, bool verbose, std::vector<std::string> const& makeOptions = - std::vector<std::string>()) CM_OVERRIDE; + std::vector<std::string>()) override; /** Append the subdirectory for the given configuration. */ void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, const std::string& suffix, - std::string& dir) CM_OVERRIDE; + std::string& dir) override; - bool FindMakeProgram(cmMakefile*) CM_OVERRIDE; + bool FindMakeProgram(cmMakefile*) override; ///! What is the configurations directory variable called? - const char* GetCMakeCFGIntDir() const CM_OVERRIDE; + const char* GetCMakeCFGIntDir() const override; ///! expand CFGIntDir std::string ExpandCFGIntDir(const std::string& str, - const std::string& config) const CM_OVERRIDE; + const std::string& config) const override; void SetCurrentLocalGenerator(cmLocalGenerator*); /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ - bool IsMultiConfig() const CM_OVERRIDE; + bool IsMultiConfig() const override; - bool HasKnownObjectFileLocation(std::string* reason) const CM_OVERRIDE; + bool HasKnownObjectFileLocation(std::string* reason) const override; - bool IsIPOSupported() const CM_OVERRIDE { return true; } + bool IsIPOSupported() const override { return true; } - bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE; + bool UseEffectivePlatformName(cmMakefile* mf) const override; - bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE; + bool ShouldStripResourcePath(cmMakefile*) const override; - bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) CM_OVERRIDE; + bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override; void AppendFlag(std::string& flags, std::string const& flag); protected: - void AddExtraIDETargets() CM_OVERRIDE; - void Generate() CM_OVERRIDE; + void AddExtraIDETargets() override; + void Generate() override; private: cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt, @@ -144,7 +144,7 @@ private: cmXCodeObject* CreateFlatClone(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget* gtgt, cmXCodeObject* buildPhases); - void ForceLinkerLanguages() CM_OVERRIDE; + void ForceLinkerLanguages() override; void ForceLinkerLanguage(cmGeneratorTarget* gtgt); const char* GetTargetLinkFlagsVar(const cmGeneratorTarget* target) const; const char* GetTargetFileType(cmGeneratorTarget* target); @@ -219,11 +219,11 @@ private: std::vector<std::string> const& defines, bool dflag = false); - void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; protected: - const char* GetInstallTargetName() const CM_OVERRIDE { return "install"; } - const char* GetPackageTargetName() const CM_OVERRIDE { return "package"; } + const char* GetInstallTargetName() const override { return "install"; } + const char* GetPackageTargetName() const override { return "package"; } unsigned int XcodeVersion; std::string VersionString; @@ -238,7 +238,7 @@ private: bool XcodeBuildCommandInitialized; void PrintCompilerAdvice(std::ostream&, std::string const&, - const char*) const CM_OVERRIDE + const char*) const override { } diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index da2fce9..e3d30dd 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -25,10 +25,10 @@ public: this->ElseSeen = false; this->ScopeDepth = 0; } - ~cmIfFunctionBlocker() CM_OVERRIDE {} + ~cmIfFunctionBlocker() override {} bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; - bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; + cmExecutionStatus&) override; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override; std::vector<cmListFileArgument> Args; std::vector<cmListFileFunction> Functions; @@ -45,21 +45,21 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmIfCommand; } + cmCommand* Clone() override { return new cmIfCommand; } /** * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE + cmExecutionStatus&) override { return false; } diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index ceda931..3b843b2 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmIncludeCommand; } + cmCommand* Clone() override { return new cmIncludeCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index a7b3685..01d98db 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmIncludeDirectoryCommand; } + cmCommand* Clone() override { return new cmIncludeDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: // used internally diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 88ee2f8..945acdc 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -25,17 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE - { - return new cmIncludeExternalMSProjectCommand; - } + cmCommand* Clone() override { return new cmIncludeExternalMSProjectCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmIncludeGuardCommand.h b/Source/cmIncludeGuardCommand.h index 4dc3d90..eaad9b8 100644 --- a/Source/cmIncludeGuardCommand.h +++ b/Source/cmIncludeGuardCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmIncludeGuardCommand; } + cmCommand* Clone() override { return new cmIncludeGuardCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 3ea0443..8da991d 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -24,17 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE - { - return new cmIncludeRegularExpressionCommand; - } + cmCommand* Clone() override { return new cmIncludeRegularExpressionCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index b34f560..8bd0159 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmInstallCommand; } + cmCommand* Clone() override { return new cmInstallCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool HandleScriptMode(std::vector<std::string> const& args); diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index d699599..ac6e504 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -27,16 +27,16 @@ public: const char* component, MessageLevel message, bool exclude_from_all, const char* literal_args, bool optional = false); - ~cmInstallDirectoryGenerator() CM_OVERRIDE; + ~cmInstallDirectoryGenerator() override; - void Compute(cmLocalGenerator* lg) CM_OVERRIDE; + void Compute(cmLocalGenerator* lg) override; std::string GetDestination(std::string const& config) const; protected: - void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) override; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) CM_OVERRIDE; + Indent indent) override; void AddDirectoryInstallRule(std::ostream& os, const std::string& config, Indent indent, std::vector<std::string> const& dirs); diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 35c7743..d23cf06 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -30,11 +30,11 @@ public: bool exclude_from_all, const char* filename, const char* name_space, bool exportOld, bool android); - ~cmInstallExportGenerator() CM_OVERRIDE; + ~cmInstallExportGenerator() override; cmExportSet* GetExportSet() { return this->ExportSet; } - void Compute(cmLocalGenerator* lg) CM_OVERRIDE; + void Compute(cmLocalGenerator* lg) override; cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; } @@ -43,9 +43,9 @@ public: std::string const& GetDestination() const { return this->Destination; } protected: - void GenerateScript(std::ostream& os) CM_OVERRIDE; - void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE; - void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScript(std::ostream& os) override; + void GenerateScriptConfigs(std::ostream& os, Indent indent) override; + void GenerateScriptActions(std::ostream& os, Indent indent) override; void GenerateImportFile(cmExportSet const* exportSet); void GenerateImportFile(const char* config, cmExportSet const* exportSet); void ComputeTempDir(); diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 702b332..19f2559 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmInstallFilesCommand; } + cmCommand* Clone() override { return new cmInstallFilesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * This is called at the end after all the information @@ -39,8 +39,8 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - void FinalPass() CM_OVERRIDE; - bool HasFinalPass() const CM_OVERRIDE { return !this->IsFilesForm; } + void FinalPass() override; + bool HasFinalPass() const override { return !this->IsFilesForm; } protected: void CreateInstallGenerator() const; diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index b2c7c4b..0ef2a06 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -27,16 +27,16 @@ public: const char* component, MessageLevel message, bool exclude_from_all, const char* rename, bool optional = false); - ~cmInstallFilesGenerator() CM_OVERRIDE; + ~cmInstallFilesGenerator() override; - void Compute(cmLocalGenerator* lg) CM_OVERRIDE; + void Compute(cmLocalGenerator* lg) override; std::string GetDestination(std::string const& config) const; protected: - void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) override; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) CM_OVERRIDE; + Indent indent) override; void AddFilesInstallRule(std::ostream& os, std::string const& config, Indent indent, std::vector<std::string> const& files); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 813cbe8..fc1ce86 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -36,7 +36,7 @@ public: std::vector<std::string> const& configurations, const char* component, MessageLevel message, bool exclude_from_all); - ~cmInstallGenerator() CM_OVERRIDE; + ~cmInstallGenerator() override; void AddInstallRule( std::ostream& os, std::string const& dest, cmInstallType type, @@ -58,7 +58,7 @@ public: virtual void Compute(cmLocalGenerator*) {} protected: - void GenerateScript(std::ostream& os) CM_OVERRIDE; + void GenerateScript(std::ostream& os) override; std::string CreateComponentTest(const char* component, bool exclude_from_all); diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index e0ecbda..5c705eb 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmInstallProgramsCommand; } + cmCommand* Clone() override { return new cmInstallProgramsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * This is called at the end after all the information @@ -39,9 +39,9 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - void FinalPass() CM_OVERRIDE; + void FinalPass() override; - bool HasFinalPass() const CM_OVERRIDE { return true; } + bool HasFinalPass() const override { return true; } protected: std::string FindInstallSource(const char* name) const; diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 7e19aa6..fe0f7c6 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -18,10 +18,10 @@ class cmInstallScriptGenerator : public cmInstallGenerator public: cmInstallScriptGenerator(const char* script, bool code, const char* component, bool exclude_from_all); - ~cmInstallScriptGenerator() CM_OVERRIDE; + ~cmInstallScriptGenerator() override; protected: - void GenerateScript(std::ostream& os) CM_OVERRIDE; + void GenerateScript(std::ostream& os) override; std::string Script; bool Code; }; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 385d995..f6bec20 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -26,7 +26,7 @@ public: std::vector<std::string> const& configurations, const char* component, MessageLevel message, bool exclude_from_all, bool optional); - ~cmInstallTargetGenerator() CM_OVERRIDE; + ~cmInstallTargetGenerator() override; /** Select the policy for installing shared library linkable name symlinks. */ @@ -56,7 +56,7 @@ public: const std::string& config, NameType nameType = NameNormal); - void Compute(cmLocalGenerator* lg) CM_OVERRIDE; + void Compute(cmLocalGenerator* lg) override; cmGeneratorTarget* GetTarget() const { return this->Target; } @@ -65,9 +65,9 @@ public: std::string GetDestination(std::string const& config) const; protected: - void GenerateScript(std::ostream& os) CM_OVERRIDE; + void GenerateScript(std::ostream& os) override; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) CM_OVERRIDE; + Indent indent) override; void GenerateScriptForConfigObjectLibrary(std::ostream& os, const std::string& config, Indent indent); diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 17622fb..9950fb7 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmInstallTargetsCommand; } + cmCommand* Clone() override { return new cmInstallTargetsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index 6297073..3fd4e50 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -26,14 +26,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmLinkDirectoriesCommand; } + cmCommand* Clone() override { return new cmLinkDirectoriesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: void AddLinkDir(std::string const& dir); diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 54121dd..af25fba 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmLinkLibrariesCommand; } + cmCommand* Clone() override { return new cmLinkLibrariesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h index 66941d3..81b48b3 100644 --- a/Source/cmLinkLineDeviceComputer.h +++ b/Source/cmLinkLineDeviceComputer.h @@ -23,14 +23,13 @@ class cmLinkLineDeviceComputer : public cmLinkLineComputer public: cmLinkLineDeviceComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir); - ~cmLinkLineDeviceComputer() CM_OVERRIDE; + ~cmLinkLineDeviceComputer() override; std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, - std::string const& stdLibString) - CM_OVERRIDE; + std::string const& stdLibString) override; std::string GetLinkerLanguage(cmGeneratorTarget* target, - std::string const& config) CM_OVERRIDE; + std::string const& config) override; }; class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer @@ -42,8 +41,7 @@ public: cmStateDirectory const& stateDir, cmGlobalNinjaGenerator const* gg); - std::string ConvertToLinkReference(std::string const& input) const - CM_OVERRIDE; + std::string ConvertToLinkReference(std::string const& input) const override; private: cmGlobalNinjaGenerator const* GG; diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 7d3800a..2965399 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -22,14 +22,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmListCommand; } + cmCommand* Clone() override { return new cmListCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: bool HandleLengthCommand(std::vector<std::string> const& args); diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index e46144d..e0f6e4f 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmLoadCacheCommand; } + cmCommand* Clone() override { return new cmLoadCacheCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: std::set<std::string> VariablesToRead; diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index a871df9..2850032 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -34,12 +34,12 @@ public: } ///! clean up any memory allocated by the plugin - ~cmLoadedCommand() CM_OVERRIDE; + ~cmLoadedCommand() override; /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmLoadedCommand* newC = new cmLoadedCommand; // we must copy when we clone @@ -52,7 +52,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; /** * This is called at the end after all the information @@ -60,8 +60,8 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - void FinalPass() CM_OVERRIDE; - bool HasFinalPass() const CM_OVERRIDE + void FinalPass() override; + bool HasFinalPass() const override { return this->info.FinalPass != nullptr; } diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 30bb7da..021e6c7 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmLoadCommandCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmLoadCommandCommand; } + cmCommand* Clone() override { return new cmLoadCommandCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 999085e..a60573c 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -21,14 +21,14 @@ class cmLocalCommonGenerator : public cmLocalGenerator public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, std::string const& wd); - ~cmLocalCommonGenerator() CM_OVERRIDE; + ~cmLocalCommonGenerator() override; std::string const& GetConfigName() { return this->ConfigName; } std::string GetWorkingDirectory() const { return this->WorkingDirectory; } std::string GetTargetFortranFlags(cmGeneratorTarget const* target, - std::string const& config) CM_OVERRIDE; + std::string const& config) override; protected: std::string WorkingDirectory; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index b0eb1da..bb16899 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -38,14 +38,14 @@ class cmLocalNinjaGenerator : public cmLocalCommonGenerator public: cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf); - ~cmLocalNinjaGenerator() CM_OVERRIDE; + ~cmLocalNinjaGenerator() override; - void Generate() CM_OVERRIDE; + void Generate() override; - cmRulePlaceholderExpander* CreateRulePlaceholderExpander() const CM_OVERRIDE; + cmRulePlaceholderExpander* CreateRulePlaceholderExpander() const override; - std::string GetTargetDirectory(cmGeneratorTarget const* target) const - CM_OVERRIDE; + std::string GetTargetDirectory( + cmGeneratorTarget const* target) const override; const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const; cmGlobalNinjaGenerator* GetGlobalNinjaGenerator(); @@ -76,13 +76,13 @@ public: void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, - cmGeneratorTarget const* gt = nullptr) CM_OVERRIDE; + cmGeneratorTarget const* gt = nullptr) override; protected: std::string ConvertToIncludeReference( std::string const& path, cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL, - bool forceFullPaths = false) CM_OVERRIDE; + bool forceFullPaths = false) override; private: cmGeneratedFileStream& GetBuildFileStream() const; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 16c305a..b149524 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -31,14 +31,14 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf); - ~cmLocalUnixMakefileGenerator3() CM_OVERRIDE; + ~cmLocalUnixMakefileGenerator3() override; - void ComputeHomeRelativeOutputPath() CM_OVERRIDE; + void ComputeHomeRelativeOutputPath() override; /** * Generate the makefile for this directory. */ - void Generate() CM_OVERRIDE; + void Generate() override; // this returns the relative path between the HomeOutputDirectory and this // local generators StartOutputDirectory @@ -88,9 +88,8 @@ public: const std::string& tgt); // append flags to a string - void AppendFlags(std::string& flags, - const std::string& newFlags) CM_OVERRIDE; - void AppendFlags(std::string& flags, const char* newFlags) CM_OVERRIDE; + void AppendFlags(std::string& flags, const std::string& newFlags) override; + void AppendFlags(std::string& flags, const char* newFlags) override; // append an echo command enum EchoColor @@ -113,8 +112,8 @@ public: /** Get whether the makefile is to have color. */ bool GetColorMakefile() const { return this->ColorMakefile; } - std::string GetTargetDirectory(cmGeneratorTarget const* target) const - CM_OVERRIDE; + std::string GetTargetDirectory( + cmGeneratorTarget const* target) const override; // create a command that cds to the start dir then runs the commands void CreateCDCommand(std::vector<std::string>& commands, @@ -129,10 +128,10 @@ public: /** Called from command-line hook to bring dependencies up to date for a target. */ bool UpdateDependencies(const char* tgtInfo, bool verbose, - bool color) CM_OVERRIDE; + bool color) override; /** Called from command-line hook to clear dependencies. */ - void ClearDependencies(cmMakefile* mf, bool verbose) CM_OVERRIDE; + void ClearDependencies(cmMakefile* mf, bool verbose) override; /** write some extra rules such as make test etc */ void WriteSpecialTargetsTop(std::ostream& makefileStream); @@ -254,7 +253,7 @@ private: void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, - cmGeneratorTarget const* gt = nullptr) CM_OVERRIDE; + cmGeneratorTarget const* gt = nullptr) override; friend class cmMakefileTargetGenerator; friend class cmMakefileExecutableTargetGenerator; diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h index 19e2c16..31223ec 100644 --- a/Source/cmMSVC60LinkLineComputer.h +++ b/Source/cmMSVC60LinkLineComputer.h @@ -21,8 +21,7 @@ public: cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir); - std::string ConvertToLinkReference(std::string const& input) const - CM_OVERRIDE; + std::string ConvertToLinkReference(std::string const& input) const override; }; #endif diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 003c443..74a1da0 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -19,12 +19,12 @@ public: cmMacroHelperCommand() {} ///! clean up any memory allocated by the macro - ~cmMacroHelperCommand() CM_OVERRIDE {} + ~cmMacroHelperCommand() override {} /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmMacroHelperCommand* newC = new cmMacroHelperCommand; // we must copy when we clone @@ -40,10 +40,10 @@ public: * the CMakeLists.txt file. */ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE + cmExecutionStatus&) override { return false; } diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index cbfb60f..d967388 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -19,10 +19,10 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker { public: cmMacroFunctionBlocker() { this->Depth = 0; } - ~cmMacroFunctionBlocker() CM_OVERRIDE {} + ~cmMacroFunctionBlocker() override {} bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; - bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE; + cmExecutionStatus&) override; + bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; @@ -36,14 +36,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmMacroCommand; } + cmCommand* Clone() override { return new cmMacroCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 214cf92..d2637f3 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmMakeDirectoryCommand; } + cmCommand* Clone() override { return new cmMakeDirectoryCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e1745bd..ebc8e30 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -618,7 +618,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) { std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; real_link_commands.push_back(cmakeCommand); } diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h index 122e817..b9bbe86 100644 --- a/Source/cmMakefileExecutableTargetGenerator.h +++ b/Source/cmMakefileExecutableTargetGenerator.h @@ -15,11 +15,11 @@ class cmMakefileExecutableTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target); - ~cmMakefileExecutableTargetGenerator() CM_OVERRIDE; + ~cmMakefileExecutableTargetGenerator() override; /* the main entry point for this class. Writes the Makefiles associated with this target */ - void WriteRuleFiles() CM_OVERRIDE; + void WriteRuleFiles() override; protected: virtual void WriteExecutableRule(bool relink); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 34c285c..68d73d4 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -932,7 +932,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) { std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; real_link_commands.push_back(cmakeCommand); } diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 307cd15..02fa029 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -15,11 +15,11 @@ class cmMakefileLibraryTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target); - ~cmMakefileLibraryTargetGenerator() CM_OVERRIDE; + ~cmMakefileLibraryTargetGenerator() override; /* the main entry point for this class. Writes the Makefiles associated with this target */ - void WriteRuleFiles() CM_OVERRIDE; + void WriteRuleFiles() override; protected: void WriteObjectLibraryRules(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2acd57a..1e4e02e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -629,7 +629,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const char* cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint) || (cppcheck && *cppcheck)) { - std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu"; + std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_co_compile"; if (iwyu && *iwyu) { run_iwyu += " --iwyu="; run_iwyu += this->LocalGenerator->EscapeForShell(iwyu); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e0e9580..5ab7e36 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -33,7 +33,7 @@ class cmMakefileTargetGenerator : public cmCommonTargetGenerator public: // constructor to set the ivars cmMakefileTargetGenerator(cmGeneratorTarget* target); - ~cmMakefileTargetGenerator() CM_OVERRIDE; + ~cmMakefileTargetGenerator() override; // construct using this factory call static cmMakefileTargetGenerator* New(cmGeneratorTarget* tgt); @@ -81,8 +81,7 @@ protected: { } - void operator()(cmSourceFile const& source, - const char* pkgloc) CM_OVERRIDE; + void operator()(cmSourceFile const& source, const char* pkgloc) override; private: cmMakefileTargetGenerator* Generator; @@ -168,8 +167,7 @@ protected: /** Add commands for generate def files */ void GenDefFile(std::vector<std::string>& real_link_commands); - void AddIncludeFlags(std::string& flags, - const std::string& lang) CM_OVERRIDE; + void AddIncludeFlags(std::string& flags, const std::string& lang) override; virtual void CloseFileStreams(); cmLocalUnixMakefileGenerator3* LocalGenerator; diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h index 2826392..be243a7 100644 --- a/Source/cmMakefileUtilityTargetGenerator.h +++ b/Source/cmMakefileUtilityTargetGenerator.h @@ -13,11 +13,11 @@ class cmMakefileUtilityTargetGenerator : public cmMakefileTargetGenerator { public: cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target); - ~cmMakefileUtilityTargetGenerator() CM_OVERRIDE; + ~cmMakefileUtilityTargetGenerator() override; /* the main entry point for this class. Writes the Makefiles associated with this target */ - void WriteRuleFiles() CM_OVERRIDE; + void WriteRuleFiles() override; protected: }; diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 6c22d4c..5dd198f 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmMarkAsAdvancedCommand; } + cmCommand* Clone() override { return new cmMarkAsAdvancedCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index bc97402..0c6c76b 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -19,14 +19,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmMathCommand; } + cmCommand* Clone() override { return new cmMathCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: bool HandleExprCommand(std::vector<std::string> const& args); diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 59ee458..819ebda 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -22,14 +22,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmMessageCommand; } + cmCommand* Clone() override { return new cmMessageCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h index a75de05..0ed53f4 100644 --- a/Source/cmNinjaLinkLineComputer.h +++ b/Source/cmNinjaLinkLineComputer.h @@ -23,8 +23,7 @@ public: cmStateDirectory const& stateDir, cmGlobalNinjaGenerator const* gg); - std::string ConvertToLinkReference(std::string const& input) const - CM_OVERRIDE; + std::string ConvertToLinkReference(std::string const& input) const override; private: cmGlobalNinjaGenerator const* GG; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 32377f8..8b331d5 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -495,7 +495,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += " -E __run_co_compile --lwyu="; cmGeneratorTarget& gt = *this->GetGeneratorTarget(); const std::string cfgName = this->GetConfigName(); std::string targetOutput = ConvertToNinjaPath(gt.GetFullPath(cfgName)); diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index d8baa67..01cc881 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -16,9 +16,9 @@ class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator { public: cmNinjaNormalTargetGenerator(cmGeneratorTarget* target); - ~cmNinjaNormalTargetGenerator() CM_OVERRIDE; + ~cmNinjaNormalTargetGenerator() override; - void Generate() CM_OVERRIDE; + void Generate() override; private: std::string LanguageLinkerRule() const; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3760fc1..3c1463a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -619,7 +619,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) (cppcheck && *cppcheck)) { std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); - run_iwyu += " -E __run_iwyu"; + run_iwyu += " -E __run_co_compile"; if (iwyu && *iwyu) { run_iwyu += " --iwyu="; run_iwyu += this->GetLocalGenerator()->EscapeForShell(iwyu); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e15ba25..770a99d 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -31,7 +31,7 @@ public: cmNinjaTargetGenerator(cmGeneratorTarget* target); /// Destructor. - ~cmNinjaTargetGenerator() CM_OVERRIDE; + ~cmNinjaTargetGenerator() override; virtual void Generate() = 0; @@ -77,8 +77,7 @@ protected: std::string ComputeFlagsForObject(cmSourceFile const* source, const std::string& language); - void AddIncludeFlags(std::string& flags, - std::string const& lang) CM_OVERRIDE; + void AddIncludeFlags(std::string& flags, std::string const& lang) override; std::string ComputeDefines(cmSourceFile const* source, const std::string& language); @@ -142,8 +141,7 @@ protected: { } - void operator()(cmSourceFile const& source, - const char* pkgloc) CM_OVERRIDE; + void operator()(cmSourceFile const& source, const char* pkgloc) override; private: cmNinjaTargetGenerator* Generator; diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h index 361befe..01cc459 100644 --- a/Source/cmNinjaUtilityTargetGenerator.h +++ b/Source/cmNinjaUtilityTargetGenerator.h @@ -13,9 +13,9 @@ class cmNinjaUtilityTargetGenerator : public cmNinjaTargetGenerator { public: cmNinjaUtilityTargetGenerator(cmGeneratorTarget* target); - ~cmNinjaUtilityTargetGenerator() CM_OVERRIDE; + ~cmNinjaUtilityTargetGenerator() override; - void Generate() CM_OVERRIDE; + void Generate() override; }; #endif // ! cmNinjaUtilityTargetGenerator_h diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index d6e51a5..34e0e6f 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmOptionCommand; } + cmCommand* Clone() override { return new cmOptionCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 1ee0578..27ad710 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -149,7 +149,7 @@ public: } } - void Report(std::ostream& e) CM_OVERRIDE + void Report(std::ostream& e) override { e << "runtime library ["; if (this->SOName.empty()) { @@ -160,7 +160,7 @@ public: e << "]"; } - bool FindConflict(std::string const& dir) CM_OVERRIDE; + bool FindConflict(std::string const& dir) override; private: // The soname of the shared library if it is known. @@ -204,12 +204,12 @@ public: { } - void Report(std::ostream& e) CM_OVERRIDE + void Report(std::ostream& e) override { e << "link library [" << this->FileName << "]"; } - bool FindConflict(std::string const& dir) CM_OVERRIDE; + bool FindConflict(std::string const& dir) override; }; bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 6dcb888..09e622b 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -18,9 +18,9 @@ class cmExecutionStatus; class cmOutputRequiredFilesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; } + cmCommand* Clone() override { return new cmOutputRequiredFilesCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; void ListDependencies(cmDependInformation const* info, FILE* fout, std::set<cmDependInformation const*>* visited); diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h index 469a76a..b8ba61d 100644 --- a/Source/cmParseArgumentsCommand.h +++ b/Source/cmParseArgumentsCommand.h @@ -21,14 +21,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmParseArgumentsCommand; } + cmCommand* Clone() override { return new cmParseArgumentsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index 5b357cd..23fa74e 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -59,7 +59,7 @@ public: char Separator; char LineEnd; bool IgnoreCR; - bool ProcessChunk(const char* data, int length) CM_OVERRIDE; + bool ProcessChunk(const char* data, int length) override; /** Implement in a subclass to process one line of input. It should return true only if it is interested in more data. */ @@ -76,7 +76,7 @@ public: } private: - bool ProcessLine() CM_OVERRIDE { return true; } + bool ProcessLine() override { return true; } }; /** Run a process and send output to given parsers. */ diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index afe489a..80fa235 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -26,14 +26,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmProjectCommand; } + cmCommand* Clone() override { return new cmProjectCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 014a4ab..c1dcd54 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapCPPCommand; } + cmCommand* Clone() override { return new cmQTWrapCPPCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index f7e6bdd..15cab40 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmQTWrapUICommand; } + cmCommand* Clone() override { return new cmQTWrapUICommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index 9e035d7..7b11849 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmRemoveCommand; } + cmCommand* Clone() override { return new cmRemoveCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index c2c6b0e..a5cb204 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmRemoveDefinitionsCommand; } + cmCommand* Clone() override { return new cmRemoveDefinitionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 53c91cd..ef39614 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmReturnCommand; } + cmCommand* Clone() override { return new cmReturnCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 2d4c7cd..988ad23 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmSeparateArgumentsCommand; } + cmCommand* Clone() override { return new cmSeparateArgumentsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 3faec6f..76e3eae 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmSetCommand; } + cmCommand* Clone() override { return new cmSetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 16a07da..473347c 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -16,17 +16,14 @@ class cmMakefile; class cmSetDirectoryPropertiesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE - { - return new cmSetDirectoryPropertiesCommand; - } + cmCommand* Clone() override { return new cmSetDirectoryPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * Static entry point for use by other commands diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 4d3d996..f1126bb 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -22,14 +22,14 @@ class cmSetPropertyCommand : public cmCommand public: cmSetPropertyCommand(); - cmCommand* Clone() CM_OVERRIDE { return new cmSetPropertyCommand; } + cmCommand* Clone() override { return new cmSetPropertyCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: std::set<std::string> Names; diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index ca3d74d..afb19f6 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -16,17 +16,14 @@ class cmMakefile; class cmSetSourceFilesPropertiesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE - { - return new cmSetSourceFilesPropertiesCommand; - } + cmCommand* Clone() override { return new cmSetSourceFilesPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; static bool RunCommand(cmMakefile* mf, std::vector<std::string>::const_iterator filebeg, diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index de20a7b..c9755da 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -16,14 +16,14 @@ class cmMakefile; class cmSetTargetPropertiesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmSetTargetPropertiesCommand; } + cmCommand* Clone() override { return new cmSetTargetPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** * Used by this command and cmSetPropertiesCommand diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index cd9f486..84b2645 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -16,14 +16,14 @@ class cmMakefile; class cmSetTestsPropertiesCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmSetTestsPropertiesCommand; } + cmCommand* Clone() override { return new cmSetTestsPropertiesCommand; } /** * This is called when the command is first encountered in * the input file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; static bool SetOneTest(const std::string& tname, std::vector<std::string>& propertyPairs, diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index c042a13..2d8dc17 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmSiteNameCommand; } + cmCommand* Clone() override { return new cmSiteNameCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 1af5274..ed02ca5 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmSourceGroupCommand; } + cmCommand* Clone() override { return new cmSourceGroupCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: bool processTree(const std::vector<std::string>& args, diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index f19f871..b287e37 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -22,14 +22,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmStringCommand; } + cmCommand* Clone() override { return new cmStringCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: bool HandleConfigureCommand(std::vector<std::string> const& args); diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index e5fbb7d..adab757 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -25,14 +25,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmSubdirCommand; } + cmCommand* Clone() override { return new cmSubdirCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index bcda82e..2db28c6 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmSubdirDependsCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmSubdirDependsCommand; } + cmCommand* Clone() override { return new cmSubdirDependsCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index fd9fb5e..4118664 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -603,6 +603,56 @@ std::vector<std::string> cmSystemTools::ParseArguments(const char* command) return args; } +bool cmSystemTools::SplitProgramFromArgs(std::string const& command, + std::string& program, + std::string& args) +{ + const char* c = command.c_str(); + + // Skip leading whitespace. + while (isspace(static_cast<unsigned char>(*c))) { + ++c; + } + + // Parse one command-line element up to an unquoted space. + bool in_escape = false; + bool in_double = false; + bool in_single = false; + for (; *c; ++c) { + if (in_single) { + if (*c == '\'') { + in_single = false; + } else { + program += *c; + } + } else if (in_escape) { + in_escape = false; + program += *c; + } else if (*c == '\\') { + in_escape = true; + } else if (in_double) { + if (*c == '"') { + in_double = false; + } else { + program += *c; + } + } else if (*c == '"') { + in_double = true; + } else if (*c == '\'') { + in_single = true; + } else if (isspace(static_cast<unsigned char>(*c))) { + break; + } else { + program += *c; + } + } + + // The remainder of the command line holds unparsed arguments. + args = c; + + return !in_single && !in_escape && !in_double; +} + size_t cmSystemTools::CalculateCommandLineLengthLimit() { size_t sz = diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 9bec361..e7082e6 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -255,6 +255,11 @@ public: static void ParseUnixCommandLine(const char* command, std::vector<std::string>& args); + /** Split a command-line string into the parsed command and the unparsed + arguments. Returns false on unfinished quoting or escaping. */ + static bool SplitProgramFromArgs(std::string const& command, + std::string& program, std::string& args); + /** * Handle response file in an argument list and return a new argument list * **/ diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 957123a..f910452 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -20,26 +20,23 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE - { - return new cmTargetCompileDefinitionsCommand; - } + cmCommand* Clone() override { return new cmTargetCompileDefinitionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; - void HandleMissingTarget(const std::string& name) CM_OVERRIDE; + void HandleImportedTarget(const std::string& tgt) override; + void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; - std::string Join(const std::vector<std::string>& content) CM_OVERRIDE; + bool prepend, bool system) override; + std::string Join(const std::vector<std::string>& content) override; }; #endif diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index d28cf62..444d260 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -16,19 +16,19 @@ class cmTarget; class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase { - cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileFeaturesCommand; } + cmCommand* Clone() override { return new cmTargetCompileFeaturesCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; - void HandleMissingTarget(const std::string& name) CM_OVERRIDE; + void HandleImportedTarget(const std::string& tgt) override; + void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; - std::string Join(const std::vector<std::string>& content) CM_OVERRIDE; + bool prepend, bool system) override; + std::string Join(const std::vector<std::string>& content) override; }; #endif diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 7786896..3fab238 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -20,23 +20,23 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmTargetCompileOptionsCommand; } + cmCommand* Clone() override { return new cmTargetCompileOptionsCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; - void HandleMissingTarget(const std::string& name) CM_OVERRIDE; + void HandleImportedTarget(const std::string& tgt) override; + void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; - std::string Join(const std::vector<std::string>& content) CM_OVERRIDE; + bool prepend, bool system) override; + std::string Join(const std::vector<std::string>& content) override; }; #endif diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 96eedc8..27a2f43 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -20,30 +20,27 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE - { - return new cmTargetIncludeDirectoriesCommand; - } + cmCommand* Clone() override { return new cmTargetIncludeDirectoriesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; - void HandleMissingTarget(const std::string& name) CM_OVERRIDE; + void HandleImportedTarget(const std::string& tgt) override; + void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; + bool prepend, bool system) override; void HandleInterfaceContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; + bool prepend, bool system) override; - std::string Join(const std::vector<std::string>& content) CM_OVERRIDE; + std::string Join(const std::vector<std::string>& content) override; }; #endif diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 333ab07..f41af49 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -27,14 +27,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmTargetLinkLibrariesCommand; } + cmCommand* Clone() override { return new cmTargetLinkLibrariesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: void LinkLibraryTypeSpecifierWarning(int left, int right); diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index b4e08e4..0639e98 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -20,24 +20,24 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmTargetSourcesCommand; } + cmCommand* Clone() override { return new cmTargetSourcesCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE; - void HandleMissingTarget(const std::string& name) CM_OVERRIDE; + void HandleImportedTarget(const std::string& tgt) override; + void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool prepend, bool system) CM_OVERRIDE; + bool prepend, bool system) override; - std::string Join(const std::vector<std::string>& content) CM_OVERRIDE; + std::string Join(const std::vector<std::string>& content) override; }; #endif diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index ab0f635..1ca61c2 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -26,17 +26,17 @@ public: cmTestGenerator(cmTest* test, std::vector<std::string> const& configurations = std::vector<std::string>()); - ~cmTestGenerator() CM_OVERRIDE; + ~cmTestGenerator() override; void Compute(cmLocalGenerator* lg); protected: - void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE; - void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScriptConfigs(std::ostream& os, Indent indent) override; + void GenerateScriptActions(std::ostream& os, Indent indent) override; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) CM_OVERRIDE; - void GenerateScriptNoConfig(std::ostream& os, Indent indent) CM_OVERRIDE; - bool NeedsScriptNoConfig() const CM_OVERRIDE; + Indent indent) override; + void GenerateScriptNoConfig(std::ostream& os, Indent indent) override; + bool NeedsScriptNoConfig() const override; void GenerateOldStyle(std::ostream& os, Indent indent); cmLocalGenerator* LG; diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index b1f0da9..fbe0d78 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmTryCompileCommand; } + cmCommand* Clone() override { return new cmTryCompileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index 732dff1..b632ef5 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -24,14 +24,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmTryRunCommand; } + cmCommand* Clone() override { return new cmTryRunCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: void RunExecutable(const std::string& runArgs, diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h index 5e3ac74..7154881 100644 --- a/Source/cmUnexpectedCommand.h +++ b/Source/cmUnexpectedCommand.h @@ -21,13 +21,13 @@ public: { } - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { return new cmUnexpectedCommand(this->Name, this->Error); } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; private: std::string Name; diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 96d7010..4e1208a 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -23,14 +23,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmUnsetCommand; } + cmCommand* Clone() override { return new cmUnsetCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 86ebbf1..78f8616 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmUseMangledMesaCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; } + cmCommand* Clone() override { return new cmUseMangledMesaCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; protected: void CopyAndFullPathMesaHeader(const char* source, const char* outdir); diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 404ef3e..165ecef 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmUtilitySourceCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; } + cmCommand* Clone() override { return new cmUtilitySourceCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 811e02e..94970c5 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -15,9 +15,9 @@ class cmExecutionStatus; class cmVariableRequiresCommand : public cmCommand { public: - cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; } + cmCommand* Clone() override { return new cmVariableRequiresCommand; } bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index 59baa4d..6a8115d 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -23,24 +23,24 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmVariableWatchCommand; } + cmCommand* Clone() override { return new cmVariableWatchCommand; } //! Default constructor cmVariableWatchCommand(); //! Destructor. - ~cmVariableWatchCommand() CM_OVERRIDE; + ~cmVariableWatchCommand() override; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; /** This command does not really have a final pass but it needs to stay alive since it owns variable watch callback information. */ - bool HasFinalPass() const CM_OVERRIDE { return true; } + bool HasFinalPass() const override { return true; } protected: std::set<std::string> WatchedVariables; diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index dfd5afc..6f6d405 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -19,10 +19,10 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: cmWhileFunctionBlocker(cmMakefile* mf); - ~cmWhileFunctionBlocker() CM_OVERRIDE; + ~cmWhileFunctionBlocker() override; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; - bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE; + cmExecutionStatus&) override; + bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override; std::vector<cmListFileArgument> Args; std::vector<cmListFileFunction> Functions; @@ -39,21 +39,21 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmWhileCommand; } + cmCommand* Clone() override { return new cmWhileCommand; } /** * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE + cmExecutionStatus&) override { return false; } diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 36a08a4..9028f84 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -22,14 +22,14 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE { return new cmWriteFileCommand; } + cmCommand* Clone() override { return new cmWriteFileCommand; } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; + cmExecutionStatus& status) override; }; #endif diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx index 30c6d54..3a5606b 100644 --- a/Source/cm_codecvt.hxx +++ b/Source/cm_codecvt.hxx @@ -3,7 +3,7 @@ #ifndef cm_codecvt_hxx #define cm_codecvt_hxx -#include "cmConfigure.h" +#include "cmConfigure.h" // IWYU pragma: keep #include <locale> #include <wchar.h> @@ -23,15 +23,15 @@ public: codecvt(Encoding e); protected: - ~codecvt() CM_OVERRIDE; - bool do_always_noconv() const throw() CM_OVERRIDE; + ~codecvt() override; + bool do_always_noconv() const throw() override; result do_out(mbstate_t& state, const char* from, const char* from_end, const char*& from_next, char* to, char* to_end, - char*& to_next) const CM_OVERRIDE; + char*& to_next) const override; result do_unshift(mbstate_t& state, char* to, char*, - char*& to_next) const CM_OVERRIDE; - int do_max_length() const throw() CM_OVERRIDE; - int do_encoding() const throw() CM_OVERRIDE; + char*& to_next) const override; + int do_max_length() const throw() override; + int do_encoding() const throw() override; private: // The mbstate_t argument to do_out and do_unshift is responsible diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 91c229c..26868bc 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -34,11 +34,14 @@ #include "cmsys/Process.h" #include "cmsys/Terminal.h" #include <algorithm> +#include <functional> #include <iostream> +#include <map> #include <sstream> #include <stdio.h> #include <stdlib.h> #include <time.h> +#include <utility> class cmConnection; @@ -157,6 +160,280 @@ static bool cmTarFilesFrom(std::string const& file, return true; } +int cmcmd::HandleIWYU(const std::string& runCmd, const std::string&, + const std::vector<std::string>& orig_cmd) +{ + // Construct the iwyu command line by taking what was given + // and adding all the arguments we give to the compiler. + std::vector<std::string> iwyu_cmd; + cmSystemTools::ExpandListArgument(runCmd, iwyu_cmd, true); + iwyu_cmd.insert(iwyu_cmd.end(), orig_cmd.begin() + 1, orig_cmd.end()); + // Run the iwyu command line. Capture its stderr and hide its stdout. + // Ignore its return code because the tool always returns non-zero. + std::string stdErr; + int ret; + if (!cmSystemTools::RunSingleCommand(iwyu_cmd, nullptr, &stdErr, &ret, + nullptr, cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << iwyu_cmd[0] << "': " << stdErr << "\n"; + return 1; + } + // Warn if iwyu reported anything. + if (stdErr.find("should remove these lines:") != std::string::npos || + stdErr.find("should add these lines:") != std::string::npos) { + std::cerr << "Warning: include-what-you-use reported diagnostics:\n" + << stdErr << "\n"; + } + // always return 0 we don't want to break the compile + return 0; +} + +int cmcmd::HandleTidy(const std::string& runCmd, const std::string& sourceFile, + const std::vector<std::string>& orig_cmd) +{ + // Construct the clang-tidy command line by taking what was given + // and adding our compiler command line. The clang-tidy tool will + // automatically skip over the compiler itself and extract the + // options. + int ret; + std::vector<std::string> tidy_cmd; + cmSystemTools::ExpandListArgument(runCmd, tidy_cmd, true); + tidy_cmd.push_back(sourceFile); + tidy_cmd.push_back("--"); + tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin(), orig_cmd.end()); + + // Run the tidy command line. Capture its stdout and hide its stderr. + std::string stdOut; + std::string stdErr; + if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, &stdErr, &ret, + nullptr, cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << tidy_cmd[0] << "': " << stdErr << "\n"; + return 1; + } + // Output the stdout from clang-tidy to stderr + std::cerr << stdOut; + // If clang-tidy exited with an error do the same. + if (ret != 0) { + std::cerr << stdErr; + } + return ret; +} + +int cmcmd::HandleLWYU(const std::string& runCmd, const std::string&, + const std::vector<std::string>&) +{ + // Construct the ldd -r -u (link what you use lwyu) command line + // ldd -u -r lwuy target + std::vector<std::string> lwyu_cmd; + lwyu_cmd.push_back("ldd"); + lwyu_cmd.push_back("-u"); + lwyu_cmd.push_back("-r"); + lwyu_cmd.push_back(runCmd); + + // Run the ldd -u -r command line. + // Capture its stdout and hide its stderr. + // Ignore its return code because the tool always returns non-zero + // if there are any warnings, but we just want to warn. + std::string stdOut; + std::string stdErr; + int ret; + if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, &stdErr, &ret, + nullptr, cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << lwyu_cmd[0] << "': " << stdErr << "\n"; + return 1; + } + + // Output the stdout from ldd -r -u to stderr + // Warn if lwyu reported anything. + if (stdOut.find("Unused direct dependencies:") != std::string::npos) { + std::cerr << "Warning: " << stdOut; + } + return 0; +} + +int cmcmd::HandleCppLint(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>&) +{ + // Construct the cpplint command line. + std::vector<std::string> cpplint_cmd; + cmSystemTools::ExpandListArgument(runCmd, cpplint_cmd, true); + cpplint_cmd.push_back(sourceFile); + + // Run the cpplint command line. Capture its output. + std::string stdOut; + int ret; + if (!cmSystemTools::RunSingleCommand(cpplint_cmd, &stdOut, &stdOut, &ret, + nullptr, cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << cpplint_cmd[0] << "': " << stdOut + << "\n"; + return 1; + } + + // Output the output from cpplint to stderr + std::cerr << stdOut; + return ret; +} + +int cmcmd::HandleCppCheck(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd) +{ + // Construct the cpplint command line. + std::vector<std::string> cppcheck_cmd; + cmSystemTools::ExpandListArgument(runCmd, cppcheck_cmd, true); + // extract all the -D, -U, and -I options from the compile line + for (size_t i = 0; i < orig_cmd.size(); i++) { + const std::string& opt = orig_cmd[i]; + if (opt.size() > 2) { + if ((opt[0] == '-') && + ((opt[1] == 'D') || (opt[1] == 'I') || (opt[1] == 'U'))) { + cppcheck_cmd.push_back(opt); +// convert cl / options to - options if needed +#if defined(_WIN32) + } else if ((opt[0] == '/') && + ((opt[1] == 'D') || (opt[1] == 'I') || (opt[1] == 'U'))) { + std::string optcopy = opt; + optcopy[0] = '-'; + cppcheck_cmd.push_back(optcopy); +#endif + } + } + } + // add the source file + cppcheck_cmd.push_back(sourceFile); + + // Run the cpplint command line. Capture its output. + std::string stdOut; + std::string stdErr; + int ret; + if (!cmSystemTools::RunSingleCommand(cppcheck_cmd, &stdOut, &stdErr, &ret, + nullptr, cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << cppcheck_cmd[0] << "': " << stdOut + << "\n"; + return 1; + } + std::cerr << stdOut; + // Output the output from cpplint to stderr + if (stdErr.find("(error)") != std::string::npos || + stdErr.find("(warning)") != std::string::npos || + stdErr.find("(style)") != std::string::npos || + stdErr.find("(performance)") != std::string::npos || + stdErr.find("(portability)") != std::string::npos || + stdErr.find("(information)") != std::string::npos) { + std::cerr << "Warning: cppcheck reported diagnostics:\n"; + } + std::cerr << stdErr; + // ignore errors so build continues + return 0; +} + +// called when args[0] == "__run_co_compile" +int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) +{ + // initialize a map from command option to handler function + std::map<std::string, + std::function<int(const std::string&, const std::string&, + const std::vector<std::string>&)>> + coCompileTypes; + auto a1 = std::placeholders::_1; + auto a2 = std::placeholders::_2; + auto a3 = std::placeholders::_3; + // create a map from option to handler function for option + // if the option does not call the original command then it will need + // to set runOriginalCmd to false later in this function + coCompileTypes["--iwyu="] = std::bind(&cmcmd::HandleIWYU, a1, a2, a3); + coCompileTypes["--tidy="] = std::bind(&cmcmd::HandleTidy, a1, a2, a3); + coCompileTypes["--lwyu="] = std::bind(&cmcmd::HandleLWYU, a1, a2, a3); + coCompileTypes["--cpplint="] = std::bind(&cmcmd::HandleCppLint, a1, a2, a3); + coCompileTypes["--cppcheck="] = + std::bind(&cmcmd::HandleCppCheck, a1, a2, a3); + // copy the command options to a vector of strings + std::vector<std::string> commandOptions; + for (const auto& i : coCompileTypes) { + commandOptions.push_back(i.first); + } + + std::string runCmd; // command to be run from --thing=command + std::string sourceFile; // store --source= + std::string commandFound; // the command that was in the args list + std::vector<std::string> orig_cmd; + bool doing_options = true; + for (std::string::size_type cc = 2; cc < args.size(); cc++) { + std::string const& arg = args[cc]; + // if the arg is -- then the rest of the args after + // go into orig_cmd + if (arg == "--") { + doing_options = false; + } else if (doing_options) { + bool optionFound = false; + // check arg against all the commandOptions + for (std::vector<std::string>::size_type i = 0; + i < commandOptions.size(); ++i) { + const std::string& command = commandOptions[i]; + if (arg.compare(0, command.size(), command) == 0) { + optionFound = true; + runCmd = arg.substr(command.size()); + commandFound = command; + } + } + // check arg with --source= + if (cmHasLiteralPrefix(arg, "--source=")) { + sourceFile = arg.substr(9); + optionFound = true; + } + // if it was not a commandOptions or --source then error + if (!optionFound) { + std::cerr << "__run_co_compile given unknown argument: " << arg + << "\n"; + return 1; + } + } else { // if not doing_options then push to orig_cmd + orig_cmd.push_back(arg); + } + } + if (commandFound.empty()) { + std::cerr << "__run_co_compile missing command to run. Looking for one of " + "the following:\n"; + for (const auto& i : commandOptions) { + std::cerr << i << "\n"; + } + return 1; + } + // Default is to run the original command found after -- if the option + // does not need to do that, it should be specified here, currently only + // lwyu does that. + bool runOriginalCmd = true; + if (commandFound == "--lwyu=") { + runOriginalCmd = false; + } + if (runOriginalCmd && orig_cmd.empty()) { + std::cerr << "__run_co_compile missing compile command after --\n"; + return 1; + } + + // call the command handler here + int ret = coCompileTypes[commandFound](runCmd, sourceFile, orig_cmd); + // if the command returns non-zero then return and fail. + // for commands that do not want to break the build, they should return + // 0 no matter what. + if (ret != 0) { + return ret; + } + // if there is no original command to run return now + if (!runOriginalCmd) { + return ret; + } + // Now run the real compiler command and return its result value + if (!cmSystemTools::RunSingleCommand(orig_cmd, nullptr, nullptr, &ret, + nullptr, + cmSystemTools::OUTPUT_PASSTHROUGH)) { + std::cerr << "Error running '" << orig_cmd[0] << "'\n"; + return 1; + } + // return the return value from the original compiler command + return ret; +} + int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx @@ -280,234 +557,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 0; } #endif - // run include what you use command and then run the compile - // command. This is an internal undocumented option and should - // only be used by CMake itself when running iwyu. - if (args[1] == "__run_iwyu") { - if (args.size() < 3) { - std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]" - " [--cpplint=/path/cpplint] [--tidy=/path/tidy]" - " -- compile command\n"; - return 1; - } - bool doing_options = true; - std::vector<std::string> orig_cmd; - std::string iwyu; - std::string tidy; - std::string sourceFile; - std::string lwyu; - std::string cpplint; - std::string cppcheck; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - std::string const& arg = args[cc]; - if (arg == "--") { - doing_options = false; - } else if (doing_options && cmHasLiteralPrefix(arg, "--iwyu=")) { - iwyu = arg.substr(7); - } else if (doing_options && cmHasLiteralPrefix(arg, "--tidy=")) { - tidy = arg.substr(7); - } else if (doing_options && cmHasLiteralPrefix(arg, "--source=")) { - sourceFile = arg.substr(9); - } else if (doing_options && cmHasLiteralPrefix(arg, "--lwyu=")) { - lwyu = arg.substr(7); - } else if (doing_options && cmHasLiteralPrefix(arg, "--cpplint=")) { - cpplint = arg.substr(10); - } else if (doing_options && cmHasLiteralPrefix(arg, "--cppcheck=")) { - cppcheck = arg.substr(11); - } else if (doing_options) { - std::cerr << "__run_iwyu given unknown argument: " << arg << "\n"; - return 1; - } else { - orig_cmd.push_back(arg); - } - } - if (tidy.empty() && iwyu.empty() && lwyu.empty() && cpplint.empty() && - cppcheck.empty()) { - std::cerr << "__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, " - "--cppcheck= and/or --tidy=\n"; - return 1; - } - if ((!cpplint.empty() || !tidy.empty() || !cppcheck.empty()) && - sourceFile.empty()) { - std::cerr << "__run_iwyu --cpplint=, __run_iwyu --tidy=" - ", __run_iwyu --cppcheck require --source=\n"; - return 1; - } - if (orig_cmd.empty() && lwyu.empty()) { - std::cerr << "__run_iwyu missing compile command after --\n"; - return 1; - } - - int ret = 0; - - if (!iwyu.empty()) { - // Construct the iwyu command line by taking what was given - // and adding all the arguments we give to the compiler. - std::vector<std::string> iwyu_cmd; - cmSystemTools::ExpandListArgument(iwyu, iwyu_cmd, true); - iwyu_cmd.insert(iwyu_cmd.end(), orig_cmd.begin() + 1, orig_cmd.end()); - - // Run the iwyu command line. Capture its stderr and hide its stdout. - // Ignore its return code because the tool always returns non-zero. - std::string stdErr; - if (!cmSystemTools::RunSingleCommand(iwyu_cmd, nullptr, &stdErr, &ret, - nullptr, - cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << iwyu_cmd[0] << "': " << stdErr - << "\n"; - return 1; - } - - // Warn if iwyu reported anything. - if (stdErr.find("should remove these lines:") != std::string::npos || - stdErr.find("should add these lines:") != std::string::npos) { - std::cerr << "Warning: include-what-you-use reported diagnostics:\n" - << stdErr << "\n"; - } - } - - if (!tidy.empty()) { - // Construct the clang-tidy command line by taking what was given - // and adding our compiler command line. The clang-tidy tool will - // automatically skip over the compiler itself and extract the - // options. - std::vector<std::string> tidy_cmd; - cmSystemTools::ExpandListArgument(tidy, tidy_cmd, true); - tidy_cmd.push_back(sourceFile); - tidy_cmd.push_back("--"); - tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin(), orig_cmd.end()); - - // Run the tidy command line. Capture its stdout and hide its stderr. - std::string stdOut; - std::string stdErr; - if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, &stdErr, &ret, - nullptr, - cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << tidy_cmd[0] << "': " << stdErr - << "\n"; - return 1; - } - // Output the stdout from clang-tidy to stderr - std::cerr << stdOut; - // If clang-tidy exited with an error do the same. - if (ret != 0) { - std::cerr << stdErr; - return ret; - } - } - if (!lwyu.empty()) { - // Construct the ldd -r -u (link what you use lwyu) command line - // ldd -u -r lwuy target - std::vector<std::string> lwyu_cmd; - lwyu_cmd.push_back("ldd"); - lwyu_cmd.push_back("-u"); - lwyu_cmd.push_back("-r"); - lwyu_cmd.push_back(lwyu); - - // Run the ldd -u -r command line. - // Capture its stdout and hide its stderr. - // Ignore its return code because the tool always returns non-zero - // if there are any warnings, but we just want to warn. - std::string stdOut; - std::string stdErr; - if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, &stdErr, &ret, - nullptr, - cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << lwyu_cmd[0] << "': " << stdErr - << "\n"; - return 1; - } - - // Output the stdout from ldd -r -u to stderr - // Warn if lwyu reported anything. - if (stdOut.find("Unused direct dependencies:") != std::string::npos) { - std::cerr << "Warning: " << stdOut; - } - } - - if (!cpplint.empty()) { - // Construct the cpplint command line. - std::vector<std::string> cpplint_cmd; - cmSystemTools::ExpandListArgument(cpplint, cpplint_cmd, true); - cpplint_cmd.push_back(sourceFile); - - // Run the cpplint command line. Capture its output. - std::string stdOut; - if (!cmSystemTools::RunSingleCommand(cpplint_cmd, &stdOut, &stdOut, - &ret, nullptr, - cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << cpplint_cmd[0] << "': " << stdOut - << "\n"; - return 1; - } - - // Output the output from cpplint to stderr - std::cerr << stdOut; - - // If cpplint exited with an error do the same. - if (ret != 0) { - return ret; - } - } - - if (!cppcheck.empty()) { - // Construct the cpplint command line. - std::vector<std::string> cppcheck_cmd; - cmSystemTools::ExpandListArgument(cppcheck, cppcheck_cmd, true); - // extract all the -D, -U, and -I options from the compile line - for (size_t i = 0; i < orig_cmd.size(); i++) { - std::string& opt = orig_cmd[i]; - if (opt.size() > 2) { - if ((opt[0] == '-') && - ((opt[1] == 'D') || (opt[1] == 'I') || (opt[1] == 'U'))) { - cppcheck_cmd.push_back(opt); -#if defined(_WIN32) - } else if ((opt[0] == '/') && - ((opt[1] == 'D') || (opt[1] == 'I') || - (opt[1] == 'U'))) { - std::string optcopy = opt; - optcopy[0] = '-'; - cppcheck_cmd.push_back(optcopy); -#endif - } - } - } - // add the source file - cppcheck_cmd.push_back(sourceFile); - - // Run the cpplint command line. Capture its output. - std::string stdOut; - if (!cmSystemTools::RunSingleCommand(cppcheck_cmd, &stdOut, &stdOut, - &ret, nullptr, - cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << cppcheck_cmd[0] << "': " << stdOut - << "\n"; - return 1; - } - // Output the output from cpplint to stderr - if (stdOut.find("(error)") != std::string::npos || - stdOut.find("(warning)") != std::string::npos || - stdOut.find("(style)") != std::string::npos || - stdOut.find("(performance)") != std::string::npos || - stdOut.find("(portability)") != std::string::npos || - stdOut.find("(information)") != std::string::npos) { - std::cerr << "Warning: cppcheck reported diagnostics:\n"; - } - std::cerr << stdOut; - } - // ignore the cppcheck error code because it is likely to have them - // from bad -D stuff - ret = 0; - // Now run the real compiler command and return its result value - // unless we are lwyu - if (lwyu.empty() && - !cmSystemTools::RunSingleCommand( - orig_cmd, nullptr, nullptr, &ret, nullptr, - cmSystemTools::OUTPUT_PASSTHROUGH)) { - std::cerr << "Error running '" << orig_cmd[0] << "'\n"; - return 1; - } - return ret; + if (args[1] == "__run_co_compile") { + return cmcmd::HandleCoCompileCommands(args); } // Echo string diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 457b760..090ca08 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -18,7 +18,26 @@ public: */ static int ExecuteCMakeCommand(std::vector<std::string>&); + // define co-compile command handlers they must be public + // because they are used in a std::function map + static int HandleIWYU(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd); + static int HandleTidy(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd); + static int HandleLWYU(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd); + static int HandleCppLint(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd); + static int HandleCppCheck(const std::string& runCmd, + const std::string& sourceFile, + const std::vector<std::string>& orig_cmd); + protected: + static int HandleCoCompileCommands(std::vector<std::string>& args); static int HashSumFile(std::vector<std::string>& args, cmCryptoHash::Algo algo); static int SymlinkLibrary(std::vector<std::string>& args); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 560c19c..0a22d63 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4102,66 +4102,6 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) #endif } -void SystemTools::SplitProgramFromArgs(const std::string& path, - std::string& program, std::string& args) -{ - // see if this is a full path to a program - // if so then set program to path and args to nothing - if (SystemTools::FileExists(path)) { - program = path; - args = ""; - return; - } - // Try to find the program in the path, note the program - // may have spaces in its name so we have to look for it - std::vector<std::string> e; - std::string findProg = SystemTools::FindProgram(path, e); - if (!findProg.empty()) { - program = findProg; - args = ""; - return; - } - - // Now try and peel off space separated chunks from the end of the string - // so the largest path possible is found allowing for spaces in the path - std::string dir = path; - std::string::size_type spacePos = dir.rfind(' '); - while (spacePos != std::string::npos) { - std::string tryProg = dir.substr(0, spacePos); - // See if the file exists - if (SystemTools::FileExists(tryProg)) { - program = tryProg; - // remove trailing spaces from program - std::string::size_type pos = program.size() - 1; - while (program[pos] == ' ') { - program.erase(pos); - pos--; - } - args = dir.substr(spacePos, dir.size() - spacePos); - return; - } - // Now try and find the program in the path - findProg = SystemTools::FindProgram(tryProg, e); - if (!findProg.empty()) { - program = findProg; - // remove trailing spaces from program - std::string::size_type pos = program.size() - 1; - while (program[pos] == ' ') { - program.erase(pos); - pos--; - } - args = dir.substr(spacePos, dir.size() - spacePos); - return; - } - // move past the space for the next search - spacePos--; - spacePos = dir.rfind(' ', spacePos); - } - - program = ""; - args = ""; -} - std::string SystemTools::GetCurrentDateTime(const char* format) { char buf[1024]; diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 1672e92..41a60d3 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -498,12 +498,6 @@ public: static std::string GetFilenameName(const std::string&); /** - * Split a program from its arguments and handle spaces in the paths - */ - static void SplitProgramFromArgs(const std::string& path, - std::string& program, std::string& args); - - /** * Return longest file extension of a full filename (dot included) */ static std::string GetFilenameExtension(const std::string&); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 640b542..ce53454 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -268,7 +268,7 @@ if(BUILD_TESTING) endif() add_test(NAME CMake.Copyright - COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake) + COMMAND ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake) # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) @@ -329,7 +329,7 @@ if(BUILD_TESTING) set(CMAKE_SKIP_VSGNUFortran TRUE) endif() if(NOT CMAKE_SKIP_VSGNUFortran) - ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake) + ADD_TEST_MACRO(VSGNUFortran ${CMAKE_CMAKE_COMMAND} -P runtest.cmake) endif() endif() @@ -813,31 +813,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory") - #add_test(SimpleExclude ${CMAKE_CTEST_COMMAND} - # --build-and-test - # "${CMake_SOURCE_DIR}/Tests/SimpleExclude" - # "${CMake_BINARY_DIR}/Tests/SimpleExclude" - # ${build_generator_args} - # --build-project SimpleExclude - # --build-two-config - # --build-options ${build_options} - # --test-command t4 - #--test-command "${CMAKE_COMMAND}" - #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}" - #-P "${CMake_BINARY_DIR}/Tests/SimpleExclude/run.cmake" - #) - -# add_test(SameName ${CMAKE_CTEST_COMMAND} -# --build-and-test -# "${CMake_SOURCE_DIR}/Tests/SameName" -# "${CMake_BINARY_DIR}/Tests/SameName" -# ${build_generator_args} -# --build-project SameName -# --build-two-config -# --build-options ${build_options} -# --test-command -# "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2") - add_test(OutOfSource ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/OutOfSource" @@ -2666,7 +2641,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA" DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCoverage") add_test(NAME CTestGTMCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/MumpsCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestGTMCoverage PROPERTIES @@ -2684,7 +2659,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA" DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage") add_test(NAME CTestCacheCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestCacheCoverage PROPERTIES @@ -2702,7 +2677,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release file(COPY "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coveragetest" DESTINATION "${CMake_BINARY_DIR}/Testing/PythonCoverage") add_test(NAME CTestPythonCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/PythonCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestPythonCoverage PROPERTIES @@ -2720,7 +2695,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release file(COPY "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/src" DESTINATION "${CMake_BINARY_DIR}/Testing/CoberturaCoverage") add_test(NAME CTestCoberturaCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/CoberturaCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestCoberturaCoverage PROPERTIES @@ -2739,7 +2714,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in" "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml") add_test(NAME CTestJacocoCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/JacocoCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestJacocoCoverage PROPERTIES @@ -2758,7 +2733,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release DESTINATION "${CMake_BINARY_DIR}/Testing/JavascriptCoverage" FILES_MATCHING PATTERN "*.js") add_test(NAME CTestJavascriptCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/JavascriptCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestJavascriptCoverage PROPERTIES @@ -2776,7 +2751,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html.in" "${CMake_BINARY_DIR}/Testing/DelphiCoverage/UTCovTest(UTCovTest.pas).html") add_test(NAME CTestDelphiCoverage - COMMAND cmake -E chdir + COMMAND ${CMAKE_CMAKE_COMMAND} -E chdir ${CMake_BINARY_DIR}/Testing/DelphiCoverage $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestDelphiCoverage PROPERTIES diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-stderr.txt index 338f7c4..338f7c4 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-stderr.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no----result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no----result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt new file mode 100644 index 0000000..f0597d2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt @@ -0,0 +1 @@ +^__run_co_compile given unknown argument: command-does-not-exist$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no----result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no----result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt new file mode 100644 index 0000000..bba846e --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt @@ -0,0 +1 @@ +^__run_co_compile missing compile command after --$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt new file mode 100644 index 0000000..ffa1da8 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt @@ -0,0 +1,5 @@ +^__run_co_compile missing command to run. Looking for one of the following: +.*--cppcheck= +.*--cpplint= +.*--iwyu= +.*--tidy= diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt deleted file mode 100644 index c251adf..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu given unknown argument: command-does-not-exist$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt deleted file mode 100644 index 1998abb..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu missing compile command after --$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt deleted file mode 100644 index 9db95f8..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, --cppcheck= and/or --tidy=$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 6efcc12..55eac5e 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -21,10 +21,10 @@ run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world") run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time) -run_cmake_command(E___run_iwyu-no-iwyu ${CMAKE_COMMAND} -E __run_iwyu -- command-does-not-exist) -run_cmake_command(E___run_iwyu-bad-iwyu ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist -- command-does-not-exist) -run_cmake_command(E___run_iwyu-no--- ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist command-does-not-exist) -run_cmake_command(E___run_iwyu-no-cc ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist --) +run_cmake_command(E___run_co_compile-no-iwyu ${CMAKE_COMMAND} -E __run_co_compile -- command-does-not-exist) +run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist -- command-does-not-exist) +run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist) +run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --) run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) diff --git a/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt new file mode 100644 index 0000000..2370ce1 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt @@ -0,0 +1,2 @@ +stdout from bad command line arg '-bad' +stderr from bad command line arg '-bad' diff --git a/Tests/RunCMake/Cppcheck/C-bad.cmake b/Tests/RunCMake/Cppcheck/C-bad.cmake new file mode 100644 index 0000000..920e4b4 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-bad.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -bad) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake index ae14f8c..5fd4ead 100644 --- a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake @@ -15,6 +15,7 @@ endfunction() run_cppcheck(C) run_cppcheck(CXX) +run_cppcheck(C-bad) if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_cppcheck(C-launch) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 1b71a31..dd73cd4 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -9,13 +9,13 @@ run_cmake(BadFoundVar) set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") run_cmake(any_version_find_0) -# Find a package with more customary version number, without requestion a specific version and in +# Find a package with more customary version number, without requesting a specific version and in # the presence of a cache variable VERSION. -set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudoNoVersionVar_VERSION=1.2.3.4.5_SHOULD_BE_IGNORED" "-DVERSION=BAD_VERSION") +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudoNoVersionVar_VERSION=1.2.3.4_SHOULD_BE_IGNORED" "-DVERSION=BAD_VERSION") run_cmake(any_version_VERSION_cache_variable) -# Find a package with a more customary version number, without requestion a specific version. -set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5") +# Find a package with a more customary version number, without requesting a specific version. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4") run_cmake(any_version) # test EXACT mode with every subcomponent diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index 4aae4ae..08b51d9 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -47,11 +47,11 @@ but do not actually build anything. To add a test: containing expected test results: ``<SubTest>-result.txt`` - Process result expected if not "0" + Regex matching expected process result, if not ``0`` ``<SubTest>-stdout.txt`` Regex matching expected stdout content ``<SubTest>-stderr.txt`` - Regex matching expected stderr content, if not "^$" + Regex matching expected stderr content, if not ``^$`` ``<SubTest>-check.cmake`` Custom result check. diff --git a/Tests/RunCMake/get_filename_component/KnownComponents.cmake b/Tests/RunCMake/get_filename_component/KnownComponents.cmake index 7dfb55d..ac77ac3 100644 --- a/Tests/RunCMake/get_filename_component/KnownComponents.cmake +++ b/Tests/RunCMake/get_filename_component/KnownComponents.cmake @@ -80,6 +80,17 @@ get_filename_component(test_program_name "/ arg1 arg2" PROGRAM check("PROGRAM with args output: name" "${test_program_name}" "/") check("PROGRAM with args output: args" "${test_program_args}" " arg1 arg2") +get_filename_component(test_program_name " " PROGRAM) +check("PROGRAM with just a space" "${test_program_name}" "") + +get_filename_component(test_program_name "${CMAKE_CURRENT_LIST_FILE}" PROGRAM) +check("PROGRAM specified explicitly without quoting" "${test_program_name}" "${CMAKE_CURRENT_LIST_FILE}") + +get_filename_component(test_program_name "\"${CMAKE_CURRENT_LIST_FILE}\" arg1 arg2" PROGRAM + PROGRAM_ARGS test_program_args) +check("PROGRAM specified explicitly with arguments: name" "${test_program_name}" "${CMAKE_CURRENT_LIST_FILE}") +check("PROGRAM specified explicitly with arguments: args" "${test_program_args}" " arg1 arg2") + list(APPEND non_cache_vars test_program_name) list(APPEND non_cache_vars test_program_args) diff --git a/Tests/RunCMake/pseudo_cppcheck.c b/Tests/RunCMake/pseudo_cppcheck.c index 32e6e28..8667e5e 100644 --- a/Tests/RunCMake/pseudo_cppcheck.c +++ b/Tests/RunCMake/pseudo_cppcheck.c @@ -1,7 +1,18 @@ #include <stdio.h> +#include <stdlib.h> +#include <string.h> -int main(void) +int main(int argc, char* argv[]) { + int i; + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-bad") == 0) + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } + } fprintf(stderr, "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12," " which is out of bounds.\n"); diff --git a/Tests/SameName/CMakeLists.txt b/Tests/SameName/CMakeLists.txt deleted file mode 100644 index d78879d..0000000 --- a/Tests/SameName/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project(SameName C) - -add_subdirectory(Lib1) - -include_directories(${PROJECT_SOURCE_DIR}/Lib1) -add_subdirectory(Exe1) diff --git a/Tests/SameName/Exe1/CMakeLists.txt b/Tests/SameName/Exe1/CMakeLists.txt deleted file mode 100644 index b9182f2..0000000 --- a/Tests/SameName/Exe1/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# a target with the same name as a target in a different dir -add_executable(mytest_exe conly.c) -set_target_properties(mytest_exe PROPERTIES OUTPUT_NAME mytest) -target_link_libraries(mytest_exe mytest) - -# and two targets in the same dir with the same name -add_library(mytest2 ../Lib1/libc1.c) - -add_executable(mytest2_exe conly.c) -set_target_properties(mytest2_exe PROPERTIES OUTPUT_NAME mytest2) -target_link_libraries(mytest2_exe mytest2) diff --git a/Tests/SameName/Exe1/conly.c b/Tests/SameName/Exe1/conly.c deleted file mode 100644 index 8f2ce05..0000000 --- a/Tests/SameName/Exe1/conly.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "libc1.h" -#include <stdio.h> - -int main() -{ - if (LibC1Func() != 2.0) { - printf("Problem with libc1\n"); - return 1; - } - return 0; -} diff --git a/Tests/SameName/Lib1/CMakeLists.txt b/Tests/SameName/Lib1/CMakeLists.txt deleted file mode 100644 index 40fa154..0000000 --- a/Tests/SameName/Lib1/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(mytest libc1.c) diff --git a/Tests/SameName/Lib1/libc1.c b/Tests/SameName/Lib1/libc1.c deleted file mode 100644 index b01e1e1..0000000 --- a/Tests/SameName/Lib1/libc1.c +++ /dev/null @@ -1,4 +0,0 @@ -float LibC1Func() -{ - return 2.0; -} diff --git a/Tests/SameName/Lib1/libc1.h b/Tests/SameName/Lib1/libc1.h deleted file mode 100644 index 84c94a9..0000000 --- a/Tests/SameName/Lib1/libc1.h +++ /dev/null @@ -1 +0,0 @@ -extern float LibC1Func(); diff --git a/Tests/SimpleExclude/CMakeLists.txt b/Tests/SimpleExclude/CMakeLists.txt deleted file mode 100644 index baca23e..0000000 --- a/Tests/SimpleExclude/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project(SimpleExclude C) - -set(EXECUTABLE_OUTPUT_PATH "${SimpleExclude_BINARY_DIR}" CACHE INTERNAL "" FORCE) -set(LIBRARY_OUTPUT_PATH "${SimpleExclude_BINARY_DIR}" CACHE INTERNAL "" FORCE) - -add_subdirectory(dirC EXCLUDE_FROM_ALL) -add_subdirectory(dirD) - -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/run.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/run.cmake" @ONLY) diff --git a/Tests/SimpleExclude/dirC/CMakeLists.txt b/Tests/SimpleExclude/dirC/CMakeLists.txt deleted file mode 100644 index 9b59fda..0000000 --- a/Tests/SimpleExclude/dirC/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(dirA EXCLUDE_FROM_ALL) -add_subdirectory(dirB) - diff --git a/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt b/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt deleted file mode 100644 index 52fac81..0000000 --- a/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library(t1 STATIC t1.c) - -add_library(t2 STATIC t2.c) - -add_executable(t3 t3.c) - -add_executable(t4 t4.c) - -add_executable(t5 t5.c) -target_link_libraries(t5 t1) diff --git a/Tests/SimpleExclude/dirC/dirA/t1.c b/Tests/SimpleExclude/dirC/dirA/t1.c deleted file mode 100644 index 67fe06f..0000000 --- a/Tests/SimpleExclude/dirC/dirA/t1.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> - -int tlib1func() -{ - Should not be build unless target directory A, B, or C are build; - printf("This is T1\n"); - return 5; -} diff --git a/Tests/SimpleExclude/dirC/dirA/t2.c b/Tests/SimpleExclude/dirC/dirA/t2.c deleted file mode 100644 index 6aaf406..0000000 --- a/Tests/SimpleExclude/dirC/dirA/t2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int tlib2func() -{ - printf("This is T2\n"); - return 2; -} diff --git a/Tests/SimpleExclude/dirC/dirA/t3.c b/Tests/SimpleExclude/dirC/dirA/t3.c deleted file mode 100644 index 1366dc0..0000000 --- a/Tests/SimpleExclude/dirC/dirA/t3.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(int argc, char* argv[]) -{ - Should not be build unless target directory A, B, or C are build; - return 0; -} diff --git a/Tests/SimpleExclude/dirC/dirA/t4.c b/Tests/SimpleExclude/dirC/dirA/t4.c deleted file mode 100644 index b0e4000..0000000 --- a/Tests/SimpleExclude/dirC/dirA/t4.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <stdio.h> - -#ifdef __CLASSIC_C__ -int main() -{ - int ac; - char* av[]; -#else -int main(int ac, char* av[]) -{ -#endif - if (ac > 1000) { - return *av[0]; - } - printf("This is T4. This one should work.\n"); - return 0; -} diff --git a/Tests/SimpleExclude/dirC/dirA/t5.c b/Tests/SimpleExclude/dirC/dirA/t5.c deleted file mode 100644 index 1fba212..0000000 --- a/Tests/SimpleExclude/dirC/dirA/t5.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(int argc, char* argv[]) -{ - Should not be build unless target directory A, B, or C are build; - return 5; -} diff --git a/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt b/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt deleted file mode 100644 index ea4650c..0000000 --- a/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library(t6 STATIC t6.c) - -add_library(t7 STATIC t7.c) -target_link_libraries(t7 t2) - diff --git a/Tests/SimpleExclude/dirC/dirB/t6.c b/Tests/SimpleExclude/dirC/dirB/t6.c deleted file mode 100644 index e8877df..0000000 --- a/Tests/SimpleExclude/dirC/dirB/t6.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> - -int tlib6func() -{ - Should not be build unless target directory B, or C are build; - printf("This is T6\n"); - return 6; -} diff --git a/Tests/SimpleExclude/dirC/dirB/t7.c b/Tests/SimpleExclude/dirC/dirB/t7.c deleted file mode 100644 index b613e91..0000000 --- a/Tests/SimpleExclude/dirC/dirB/t7.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <stdio.h> - -extern int tlib2func(); - -int tlib7func() -{ - printf("This is T7\n"); - - if (tlib2func() != 2) { - fprintf(stderr, "Something wrong with T2\n"); - return 1; - } - - return 7; -} diff --git a/Tests/SimpleExclude/dirD/CMakeLists.txt b/Tests/SimpleExclude/dirD/CMakeLists.txt deleted file mode 100644 index 44b8c27..0000000 --- a/Tests/SimpleExclude/dirD/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_library(t8 STATIC t8.c) - -add_executable(t9 t9.c) -target_link_libraries(t9 t7) - -add_custom_target(t4_custom ALL) -add_dependencies(t4_custom t4) diff --git a/Tests/SimpleExclude/dirD/t8.c b/Tests/SimpleExclude/dirD/t8.c deleted file mode 100644 index bddec6f..0000000 --- a/Tests/SimpleExclude/dirD/t8.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int tlib8func() -{ - printf("This is T8\n"); - return 8; -} diff --git a/Tests/SimpleExclude/dirD/t9.c b/Tests/SimpleExclude/dirD/t9.c deleted file mode 100644 index 9954ea5..0000000 --- a/Tests/SimpleExclude/dirD/t9.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <stdio.h> - -extern int tlib7func(); - -#ifdef __CLASSIC_C__ -int main() -{ - int ac; - char* av[]; -#else -int main(int ac, char* av[]) -{ -#endif - if (ac > 1000) { - return *av[0]; - } - printf("This is T9. This one should work.\n"); - - if (tlib7func() != 7) { - fprintf(stderr, "Something wrong with T7\n"); - return 1; - } - return 0; -} diff --git a/Tests/SimpleExclude/run.cmake.in b/Tests/SimpleExclude/run.cmake.in deleted file mode 100644 index d31d2e5..0000000 --- a/Tests/SimpleExclude/run.cmake.in +++ /dev/null @@ -1,13 +0,0 @@ -set(t4_name "\"@CMAKE_CURRENT_BINARY_DIR@${CFG_DIR}/t4\"") -exec_program("${t4_name}" RETURN_VALUE "t4_var") -message("T4 ${t4_name} resulted ${t4_var}") - -set(t9_name "\"@CMAKE_CURRENT_BINARY_DIR@${CFG_DIR}/t9\"") -exec_program("${t9_name}" RETURN_VALUE "t9_var") -message("T9 ${t9_name} resulted ${t9_var}") - -if ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) - message("Everything is good, Yoshimi won...") -else () - message(FATAL_ERROR "Yoshimi lost... The evil pink robots will take over the world") -endif () diff --git a/Tests/VSGNUFortran/runtest.cmake.in b/Tests/VSGNUFortran/runtest.cmake.in index 987207b..fc05715 100644 --- a/Tests/VSGNUFortran/runtest.cmake.in +++ b/Tests/VSGNUFortran/runtest.cmake.in @@ -14,7 +14,7 @@ file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") message("${MINGW_PATH}") set(test_exe "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran.exe") -set(ENV{PATH} "${MINGW_PATH}";$ENV{PATH}) +set(ENV{PATH} "${MINGW_PATH};$ENV{PATH}") message("run ${test_exe}") execute_process(COMMAND "${test_exe}" RESULT_VARIABLE res) @@ -889,6 +889,12 @@ rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}" +# If building in-source, remove any cmConfigure.h that may +# have been created by a previous run of the bootstrap cmake. +if [ -n "${cmake_in_source_build}" ]; then + rm -f "${cmake_source_dir}/Source/cmConfigure.h" +fi + # If exist compiler flags, set them cmake_c_flags=${CFLAGS} cmake_cxx_flags=${CXXFLAGS} @@ -1266,7 +1272,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insal cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE" cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH" -cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE" cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)" # Regenerate configured headers |