diff options
154 files changed, 1291 insertions, 1088 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 34bb6bb..4d7c6fd 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -107,6 +107,14 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(SPHINX_QTHELP) list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) endif() + if(CMake_BUILD_DEVELOPER_REFERENCE) + if(CMake_BUILD_DEVELOPER_REFERENCE_HTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html) + endif() + if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-qthelp) + endif() + endif() set(_CPACK_IFW_COMPONENTS_CONFIGURATION " # Components set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") @@ -122,7 +130,8 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # Components scripts configuration foreach(_script CMake - CMake.Documentation.SphinxHTML) + CMake.Documentation.SphinxHTML + CMake.DeveloperReference.HTML) configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" "${CMake_BINARY_DIR}/${_script}.qs" @ONLY) endforeach() @@ -136,6 +145,11 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(SPHINX_HTML) set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") endif() + if(CMake_BUILD_DEVELOPER_REFERENCE) + if(CMake_BUILD_DEVELOPER_REFERENCE_HTML) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/developer-reference/html/index.html\", \"@StartMenuDir@/CMake Developer Reference.lnk\");\n") + endif() + endif() configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" "${CMake_BINARY_DIR}/installscript.qs" @ONLY ) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 1d61613..d7a33bc 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -175,6 +175,29 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp") set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + # Developer Reference + set(CPACK_COMPONENT_GROUP_DEVELOPERREFERENCE_DISPLAY_NAME "Developer Reference") + set(CPACK_COMPONENT_GROUP_DEVELOPERREFERENCE_DESCRIPTION + "CMake Reference in different formats (html, qch)") + set(CPACK_COMPONENT_GROUP_DEVELOPERREFERENCE_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DEVELOPERREFERENCE_PRIORITY 50) + set(CPACK_IFW_COMPONENT_GROUP_DEVELOPERREFERENCE_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_DISPLAY_NAME "HTML") + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_GROUP DeveloperReference) + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_DISABLED TRUE) + set(CPACK_IFW_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_NAME "HTML") + set(CPACK_IFW_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_SCRIPT + "@CMake_BINARY_DIR@/CMake.DeveloperReference.HTML.qs") + set(CPACK_IFW_COMPONENT_CMAKE-DEVELOPER-REFERENCE-HTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-QTHELP_DISPLAY_NAME "Qt Compressed Help") + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-QTHELP_GROUP DeveloperReference) + set(CPACK_COMPONENT_CMAKE-DEVELOPER-REFERENCE-QTHELP_DISABLED TRUE) + set(CPACK_IFW_COMPONENT_CMAKE-DEVELOPER-REFERENCE-QTHELP_NAME "QtHelp") + set(CPACK_IFW_COMPONENT_CMAKE-DEVELOPER-REFERENCE-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + endif() if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/CMakeLists.txt b/CMakeLists.txt index ae5990e..3aef619 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,11 @@ option(CMake_INSTALL_DEPENDENCIES "Whether to install 3rd-party runtime dependencies" OFF) mark_as_advanced(CMake_INSTALL_DEPENDENCIES) +# option to build reference for CMake developers +option(CMake_BUILD_DEVELOPER_REFERENCE + "Build CMake Developer Reference" OFF) +mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE) + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 8f7c336..2ccc6be 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -180,6 +180,43 @@ CMake provides builtin command-line tools through the signature:: Run ``cmake -E`` or ``cmake -E help`` for a summary of commands. Available commands are: +``capabilities`` + Report cmake capabilities in JSON format. The output is a JSON object + with the following keys: + + ``version`` + A JSON object with version information. Keys are: + + ``string`` + The full version string as displayed by cmake ``--version``. + ``major`` + The major version number in integer form. + ``minor`` + The minor version number in integer form. + ``patch`` + The patch level in integer form. + ``suffix`` + The cmake version suffix string. + ``isDirty`` + A bool that is set if the cmake build is from a dirty tree. + + ``generators`` + A list available generators. Each generator is a JSON object with the + following keys: + + ``name`` + A string containing the name of the generator. + ``toolsetSupport`` + ``true`` if the generator supports toolsets and ``false`` otherwise. + ``platformSupport`` + ``true`` if the generator supports platforms and ``false`` otherwise. + ``extraGenerators`` + A list of strings with all the extra generators compatible with + the generator. + + ``serverMode`` + ``true`` if cmake supports server-mode and ``false`` otherwise. + ``chdir <dir> <cmd> [<arg>...]`` Change the current working directory and run a command. diff --git a/Help/release/dev/cmake-capabilities.rst b/Help/release/dev/cmake-capabilities.rst new file mode 100644 index 0000000..7abb973 --- /dev/null +++ b/Help/release/dev/cmake-capabilities.rst @@ -0,0 +1,6 @@ +cmake-capabilities +------------------ + +* :manual:`cmake(1)` gained a ``-E capabilities`` option to provide a + machine-readable (JSON) description of the capabilities of the + cmake tool (available generators, etc.). diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 78b716d..317a9cd 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -730,7 +730,7 @@ else() endif() # Set the user list of include dir to nothing to initialize it. -set (CUDA_NVCC_INCLUDE_ARGS_USER "") +set (CUDA_NVCC_INCLUDE_DIRS_USER "") set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext ) @@ -1025,7 +1025,7 @@ find_package_handle_standard_args(CUDA # Add include directories to pass to the nvcc command. macro(CUDA_INCLUDE_DIRECTORIES) foreach(dir ${ARGN}) - list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I${dir}) + list(APPEND CUDA_NVCC_INCLUDE_DIRS_USER ${dir}) endforeach() endmacro() @@ -1249,17 +1249,15 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # Initialize our list of includes with the user ones followed by the CUDA system ones. - set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}") - # Get the include directories for this directory and use them for our nvcc command. - # Remove duplicate entries which may be present since include_directories - # in CMake >= 2.8.8 does not remove them. - get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRECTORIES) - if(CUDA_NVCC_INCLUDE_DIRECTORIES) - foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES}) - list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir}) - endforeach() - endif() + set(CUDA_NVCC_INCLUDE_DIRS ${CUDA_NVCC_INCLUDE_DIRS_USER} "${CUDA_INCLUDE_DIRS}") + # Append the include directories for this target via generator expression, which is + # expanded by the FILE(GENERATE) call below. This generator expression captures all + # include dirs set by the user, whether via directory properties or target properties + list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>") + + # Do the same thing with compile definitions + set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>") + # Reset these variables set(CUDA_WRAP_OPTION_NVCC_FLAGS) @@ -1349,14 +1347,6 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}") endif() - # Get the list of definitions from the directory property - get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) - if(CUDA_NVCC_DEFINITIONS) - foreach(_definition ${CUDA_NVCC_DEFINITIONS}) - list(APPEND nvcc_flags "-D${_definition}") - endforeach() - endif() - if(_cuda_build_shared_libs) list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS") endif() diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index ff1f515..28cc1e9 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -73,10 +73,25 @@ set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list @CUDA_NVCC_FLAGS_CONFIG@ set(nvcc_flags @nvcc_flags@) # list -set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly). +set(CUDA_NVCC_INCLUDE_DIRS "@CUDA_NVCC_INCLUDE_DIRS@") # list (needs to be in quotes to handle spaces properly). +set(CUDA_NVCC_COMPILE_DEFINITIONS "@CUDA_NVCC_COMPILE_DEFINITIONS@") # list (needs to be in quotes to handle spaces properly). set(format_flag "@format_flag@") # string set(cuda_language_flag @cuda_language_flag@) # list +# Clean up list of include directories and add -I flags +list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRS) +set(CUDA_NVCC_INCLUDE_ARGS) +foreach(dir ${CUDA_NVCC_INCLUDE_DIRS}) + # Extra quotes are added around each flag to help nvcc parse out flags with spaces. + list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}") +endforeach() + +# Clean up list of compile definitions, add -D flags, and append to nvcc_flags +list(REMOVE_DUPLICATES CUDA_NVCC_COMPILE_DEFINITIONS) +foreach(def ${CUDA_NVCC_COMPILE_DEFINITIONS}) + list(APPEND nvcc_flags "-D${def}") +endforeach() + if(build_cubin AND NOT generated_cubin_file) message(FATAL_ERROR "You must specify generated_cubin_file on the command line") endif() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index cdc8fb1..e63bf5a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -45,9 +45,21 @@ endif() set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) -# ensure Unicode friendly APIs are used on Windows if(WIN32) + # ensure Unicode friendly APIs are used on Windows add_definitions(-DUNICODE -D_UNICODE) + + # minimize windows.h content + add_definitions(-DWIN32_LEAN_AND_MEAN) +endif() + +# configure the .dox.in file +if(CMake_BUILD_DEVELOPER_REFERENCE) + configure_file( + "${CMake_SOURCE_DIR}/Source/dir.dox.in" + "${CMake_BINARY_DIR}/Source/dir.dox" + @ONLY + ) endif() # configure the .h file diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ac1ae03..aabc839 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 6) -set(CMake_VERSION_PATCH 20160817) +set(CMake_VERSION_PATCH 20160824) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b1f6864..0d3725d 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -231,10 +231,8 @@ int cmCPackArchiveGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. @@ -259,7 +257,7 @@ int cmCPackArchiveGenerator::PackageFiles() return 1; } -int cmCPackArchiveGenerator::GenerateHeader(std::ostream*) +int cmCPackArchiveGenerator::GenerateHeader(std::ostream* /*unused*/) { return 1; } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 3edc430..1f3ac51 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -242,15 +242,11 @@ int cmCPackDebGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - else { - return PackageComponentsAllInOne(""); - } + return PackageComponentsAllInOne(""); } int cmCPackDebGenerator::createDeb() @@ -694,9 +690,8 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; if (CM_NULLPTR != GetOption(groupVar)) { return std::string(GetOption(groupVar)); - } else { - return componentName; } + return componentName; } // The following code is taken from OpenBSD ar: diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 58a2243..96c218c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -67,7 +67,8 @@ int cmCPackGenerator::PrepareNames() cmCPackLog::LOG_ERROR, "CPACK_SET_DESTDIR is set to ON but the '" << Name << "' generator does NOT support it." << std::endl); return 0; - } else if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) { + } + if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) { cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_SET_DESTDIR is set to ON but it is " << "usually a bad idea to do that with '" << Name diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 2568d17..5d81a49 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -215,15 +215,11 @@ int cmCPackRPMGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - else { - return PackageComponentsAllInOne(""); - } + return PackageComponentsAllInOne(""); } bool cmCPackRPMGenerator::SupportsComponentInstallation() const @@ -247,7 +243,6 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; if (CM_NULLPTR != GetOption(groupVar)) { return std::string(GetOption(groupVar)); - } else { - return componentName; } + return componentName; } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 771519c..de572c0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -50,7 +50,7 @@ static const char* cmDocumentationOptions[][2] = { { CM_NULLPTR, CM_NULLPTR } }; -int cpackUnknownArgument(const char*, void*) +int cpackUnknownArgument(const char* /*unused*/, void* /*unused*/) { return 1; } diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 0e08e1c..7baf7a3 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -19,7 +19,7 @@ #include <cm_expat.h> -extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*, +extern "C" int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/, const XML_Char* name, XML_Encoding* info) { @@ -215,7 +215,7 @@ private: return true; } - void StartElement(const std::string& name, const char**) CM_OVERRIDE + void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE { this->CData.clear(); if (name == "log") { @@ -275,7 +275,7 @@ private: this->CData.clear(); } - void ReportError(int, int, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE { this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index eddbddc..9dab98a 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -123,14 +123,15 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, return 0; } -void CMakeMessageCallback(const char* m, const char*, bool&, void* s) +void CMakeMessageCallback(const char* m, const char* /*unused*/, + bool& /*unused*/, void* s) { std::string* out = (std::string*)s; *out += m; *out += "\n"; } -void CMakeProgressCallback(const char* msg, float, void* s) +void CMakeProgressCallback(const char* msg, float /*unused*/, void* s) { std::string* out = (std::string*)s; *out += msg; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index f96ef6d..230e8c5 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -532,9 +532,8 @@ public: if (this->FTC->FileTimeCompare(l.c_str(), r.c_str(), &result) && result != 0) { return result < 0; - } else { - return l < r; } + return l < r; } private: diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 37bdf9a..fb96308 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -216,10 +216,9 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir) std::string flag = "-r"; flag += tagLine.substr(1); return flag; - } else { - // Use the default branch. - return "-b"; } + // Use the default branch. + return "-b"; } void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag, diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3f37f2a..dd6eb3a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -763,12 +763,11 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( this->Quiet); cov.ReadCoverageFile(coverageFile.c_str()); return static_cast<int>(cont->TotalCoverage.size()); - } else { - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Cannot find GTM coverage file: " << coverageFile - << std::endl, - this->Quiet); } + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find GTM coverage file: " << coverageFile + << std::endl, + this->Quiet); cmParseCacheCoverage ccov(*cont, this->CTest); coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov"; if (cmSystemTools::FileExists(coverageFile.c_str())) { diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index b335e32..6910f6f 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -54,8 +54,8 @@ static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb, return realsize; } -static size_t curlDebugCallback(CURL*, curl_infotype, char* chPtr, size_t size, - void* data) +static size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/, + char* chPtr, size_t size, void* data) { std::vector<char>* vec = static_cast<std::vector<char>*>(data); vec->insert(vec->end(), chPtr, chPtr + size); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index 1bda9be..09ae1fc 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -14,7 +14,7 @@ #include "cmCTestScriptHandler.h" bool cmCTestEmptyBinaryDirectoryCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) + std::vector<std::string> const& args, cmExecutionStatus& /*unused*/) { if (args.size() != 1) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index eb3d611..3e62a1a 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -261,7 +261,7 @@ private: return output; } - void ReportError(int, int, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE { this->HG->Log << "Error parsing hg log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index e1361a1..325f8a3 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -32,7 +32,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand() } bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { // Allocate space for argument values. this->Values.clear(); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 3eed79e..fedcb1f 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -126,12 +126,11 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv) this->HandleRealArg(this->RealArgV[i]); } return true; - } else { - this->RealArgC = 0; - this->RealArgV = CM_NULLPTR; - std::cerr << "No launch/command separator ('--') found!\n"; - return false; } + this->RealArgC = 0; + this->RealArgV = CM_NULLPTR; + std::cerr << "No launch/command separator ('--') found!\n"; + return false; } void cmCTestLaunch::HandleRealArg(const char* arg) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index dfa8a1a..7d0715f 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -78,7 +78,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const std::string&) CM_OVERRIDE {} + void EndElement(const std::string& /*name*/) CM_OVERRIDE {} const char* GetAttribute(const char* name, const char** atts) { @@ -638,27 +638,24 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, std::string& log, std::vector<int>& results) { - if (this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND) { - return this->ProcessMemCheckValgrindOutput(str, log, results); - } else if (this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY) { - return this->ProcessMemCheckPurifyOutput(str, log, results); - } else if (this->MemoryTesterStyle == - cmCTestMemCheckHandler::ADDRESS_SANITIZER || - this->MemoryTesterStyle == - cmCTestMemCheckHandler::THREAD_SANITIZER || - this->MemoryTesterStyle == - cmCTestMemCheckHandler::MEMORY_SANITIZER || - this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER) { - return this->ProcessMemCheckSanitizerOutput(str, log, results); - } else if (this->MemoryTesterStyle == - cmCTestMemCheckHandler::BOUNDS_CHECKER) { - return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); - } else { - log.append("\nMemory checking style used was: "); - log.append("None that I know"); - log = str; + switch (this->MemoryTesterStyle) { + case cmCTestMemCheckHandler::VALGRIND: + return this->ProcessMemCheckValgrindOutput(str, log, results); + case cmCTestMemCheckHandler::PURIFY: + return this->ProcessMemCheckPurifyOutput(str, log, results); + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: + case cmCTestMemCheckHandler::THREAD_SANITIZER: + case cmCTestMemCheckHandler::MEMORY_SANITIZER: + case cmCTestMemCheckHandler::UB_SANITIZER: + return this->ProcessMemCheckSanitizerOutput(str, log, results); + case cmCTestMemCheckHandler::BOUNDS_CHECKER: + return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); + default: + log.append("\nMemory checking style used was: "); + log.append("None that I know"); + log = str; + return true; } - return true; } std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning( diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index a4e0b95..2632870 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -824,9 +824,8 @@ bool cmCTestMultiProcessHandler::CheckCycles() << this->Properties[root]->Name << "\".\nPlease fix the cycle and run ctest again.\n"); return false; - } else { - s.push(*d); } + s.push(*d); } } } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index d4a32f1..82422a3 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -373,9 +373,8 @@ std::string cmCTestP4::GetWorkingRevision() if (rev.empty()) { return "0"; - } else { - return rev; } + return rev; } void cmCTestP4::NoteOldRevision() diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index fec23e9..24e985d 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -14,7 +14,7 @@ #include "cmCTest.h" bool cmCTestReadCustomFilesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) + std::vector<std::string> const& args, cmExecutionStatus& /*unused*/) { if (args.empty()) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index 6b5e6ed..32bf28f 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -14,7 +14,7 @@ #include "cmCTestScriptHandler.h" bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { if (args.empty()) { this->CTestScriptHandler->RunCurrentScript(); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9e3802a..49acbbf 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -54,7 +54,8 @@ bool cmCTestRunTest::CheckOutput() if (p == cmsysProcess_Pipe_None) { // Process has terminated and all output read. return false; - } else if (p == cmsysProcess_Pipe_STDOUT) { + } + if (p == cmsysProcess_Pipe_STDOUT) { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex() << ": " << line << std::endl); @@ -82,8 +83,7 @@ bool cmCTestRunTest::CheckOutput() } } } - } else // if(p == cmsysProcess_Pipe_Timeout) - { + } else { // if(p == cmsysProcess_Pipe_Timeout) break; } } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index eae0c6c..bee8296 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -80,11 +80,11 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2) // Does path p1 start with path p2? if (p1.size() == p2.size()) { return p1 == p2; - } else if (p1.size() > p2.size() && p1[p2.size()] == '/') { + } + if (p1.size() > p2.size() && p1[p2.size()] == '/') { return strncmp(p1.c_str(), p2.c_str(), p2.size()) == 0; - } else { - return false; } + return false; } std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) @@ -295,9 +295,8 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters, if (strcmp(parameters[0], "update") == 0) { return RunUpdateCommand(&args[0], out, err); - } else { - return RunChild(&args[0], out, err); } + return RunChild(&args[0], out, err); } class cmCTestSVN::LogParser : public cmCTestVC::OutputLogger, @@ -372,7 +371,7 @@ private: this->CData.clear(); } - void ReportError(int, int, const char* msg) CM_OVERRIDE + void ReportError(int /*line*/, int /*column*/, const char* msg) CM_OVERRIDE { this->SVN->Log << "Error parsing svn log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index b747c64..44427b0 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -61,7 +61,7 @@ public: cmCTestScriptFunctionBlocker() {} ~cmCTestScriptFunctionBlocker() CM_OVERRIDE {} bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus& /*status*/) CM_OVERRIDE; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); // virtual void ScopeEnded(cmMakefile &mf); @@ -69,9 +69,9 @@ public: }; // simply update the time and don't block anything -bool cmCTestScriptFunctionBlocker::IsFunctionBlocked(const cmListFileFunction&, - cmMakefile&, - cmExecutionStatus&) +bool cmCTestScriptFunctionBlocker::IsFunctionBlocked( + const cmListFileFunction& /*lff*/, cmMakefile& /*mf*/, + cmExecutionStatus& /*status*/) { this->CTestScriptHandler->UpdateElapsedTime(); return false; @@ -265,7 +265,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) return retVal; } -static void ctestScriptProgressCallback(const char* m, float, void* cd) +static void ctestScriptProgressCallback(const char* m, float /*unused*/, + void* cd) { cmCTest* ctest = static_cast<cmCTest*>(cd); if (m && *m) { diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx index a6dd6bc..464f025 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -15,7 +15,7 @@ #include <stdlib.h> // required for atoi bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { if (args.empty()) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index c64d16b..04d2f03 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -23,7 +23,7 @@ cmCTestStartCommand::cmCTestStartCommand() } bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { if (args.empty()) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 67388ad..42727d0 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -116,7 +116,8 @@ static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size, return realsize; } -static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL*, curl_infotype, +static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/, + curl_infotype /*unused*/, char* chPtr, size_t size, void* data) { @@ -976,10 +977,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( return true; } #else -bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&, - std::set<std::string> const&, - std::string const&, - std::string const&) +bool cmCTestSubmitHandler::SubmitUsingXMLRPC( + std::string const& /*unused*/, std::set<std::string> const& /*unused*/, + std::string const& /*unused*/, std::string const& /*unused*/) { return false; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index cd250fb..3ce0317 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -54,7 +54,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. @@ -67,7 +67,7 @@ public: }; bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { if (args.empty()) { this->SetError("called with incorrect number of arguments"); @@ -135,7 +135,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus& /*unused*/) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. @@ -148,7 +148,7 @@ public: }; bool cmCTestAddSubdirectoryCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) + std::vector<std::string> const& args, cmExecutionStatus& /*unused*/) { if (args.empty()) { this->SetError("called with incorrect number of arguments"); @@ -208,8 +208,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; + bool InitialPass(std::vector<std::string> const& /*args*/, + cmExecutionStatus& /*unused*/) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. @@ -222,7 +222,7 @@ public: }; bool cmCTestAddTestCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) + cmExecutionStatus& /*unused*/) { if (args.size() < 2) { this->SetError("called with incorrect number of arguments"); @@ -248,8 +248,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; + bool InitialPass(std::vector<std::string> const& /*args*/, + cmExecutionStatus& /*unused*/) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. @@ -262,7 +262,7 @@ public: }; bool cmCTestSetTestsPropertiesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) + std::vector<std::string> const& args, cmExecutionStatus& /*unused*/) { return this->TestHandler->SetTestsProperties(args); } @@ -284,14 +284,13 @@ inline int GetNextNumber(std::string const& in, int& val, } pos = pos2 + 1; return 1; + } + if (in.size() - pos == 0) { + val = -1; } else { - if (in.size() - pos == 0) { - val = -1; - } else { - val = atoi(in.substr(pos, in.size() - pos).c_str()); - } - return 0; + val = atoi(in.substr(pos, in.size() - pos).c_str()); } + return 0; } // get the next number in a string with numbers separated by , @@ -311,14 +310,13 @@ inline int GetNextRealNumber(std::string const& in, double& val, } pos = pos2 + 1; return 1; + } + if (in.size() - pos == 0) { + val = -1; } else { - if (in.size() - pos == 0) { - val = -1; - } else { - val = atof(in.substr(pos, in.size() - pos).c_str()); - } - return 0; + val = atof(in.substr(pos, in.size() - pos).c_str()); } + return 0; } cmCTestTestHandler::cmCTestTestHandler() @@ -986,7 +984,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed, *this->LogFile << "End testing: " << this->CTest->CurrentTime() << std::endl; } -void cmCTestTestHandler::GenerateTestCommand(std::vector<std::string>&, int) +void cmCTestTestHandler::GenerateTestCommand( + std::vector<std::string>& /*unused*/, int /*unused*/) { } diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 7393d21..016b32b 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -49,14 +49,13 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) if (cmSystemTools::FileExists(arg.c_str())) { this->Files.insert(arg); return true; - } else { - std::ostringstream e; - e << "File \"" << arg << "\" does not exist. Cannot submit " - << "a non-existent file."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - this->ArgumentDoing = ArgumentDoingError; - return false; } + std::ostringstream e; + e << "File \"" << arg << "\" does not exist. Cannot submit " + << "a non-existent file."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->ArgumentDoing = ArgumentDoingError; + return false; } // Look for other arguments. diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 3376588..24557aa 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -185,7 +185,7 @@ bool cmCTestVC::WriteXML(cmXMLWriter& xml) return result; } -bool cmCTestVC::WriteXMLUpdates(cmXMLWriter&) +bool cmCTestVC::WriteXMLUpdates(cmXMLWriter& /*unused*/) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "* CTest cannot extract updates for this VCS tool.\n"); diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index fa539e4..976a92d 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -42,9 +42,8 @@ public: std::string foundFileName = line.substr(begIndex + 3, endIndex - (begIndex + 4)); return foundFileName; - } else { - return line.substr(begIndex, line.npos); } + return line.substr(begIndex, line.npos); } bool ParseFile(std::string const& file) { diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 9325812..bc05666 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,7 +23,7 @@ public: ~XMLParser() CM_OVERRIDE {} protected: - void EndElement(const std::string&) CM_OVERRIDE {} + void EndElement(const std::string& /*name*/) CM_OVERRIDE {} void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index d786d79..af01496 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -128,16 +128,15 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, if (i != this->RoutineToDirectory.end()) { filepath = i->second; return true; - } else { - // try some alternate names - const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR }; - for (int k = 0; tryname[k] != CM_NULLPTR; k++) { - std::string routine2 = routine + tryname[k]; - i = this->RoutineToDirectory.find(routine2); - if (i != this->RoutineToDirectory.end()) { - filepath = i->second; - return true; - } + } + // try some alternate names + const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR }; + for (int k = 0; tryname[k] != CM_NULLPTR; k++) { + std::string routine2 = routine + tryname[k]; + i = this->RoutineToDirectory.find(routine2); + if (i != this->RoutineToDirectory.end()) { + filepath = i->second; + return true; } } return false; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 92fe642..30cd102 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -124,10 +124,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) int p = cmsysProcess_WaitForData(this->Process, &data, &length, &timeout); if (p == cmsysProcess_Pipe_Timeout) { return cmsysProcess_Pipe_Timeout; - } else if (p == cmsysProcess_Pipe_STDOUT) { + } + if (p == cmsysProcess_Pipe_STDOUT) { this->Output.insert(this->Output.end(), data, data + length); - } else // p == cmsysProcess_Pipe_None - { + } else { // p == cmsysProcess_Pipe_None // The process will provide no more data. break; } diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 606c954..80bb55d 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -51,7 +51,7 @@ cmCursesForm* cmCursesForm::CurrentForm = CM_NULLPTR; extern "C" { -void onsig(int) +void onsig(int /*unused*/) { if (cmCursesForm::CurrentForm) { endwin(); @@ -70,8 +70,8 @@ void onsig(int) } } -void CMakeMessageHandler(const char* message, const char* title, bool&, - void* clientData) +void CMakeMessageHandler(const char* message, const char* title, + bool& /*unused*/, void* clientData) { cmCursesForm* self = static_cast<cmCursesForm*>(clientData); self->AddError(message, title); diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index e36ac34..99f7dcc 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -24,7 +24,8 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, this->SetValueAsBool(false); } -bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) +bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, + WINDOW* w) { // toggle boolean values with enter or space @@ -39,9 +40,8 @@ bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) touchwin(w); wrefresh(w); return true; - } else { - return false; } + return false; } void cmCursesBoolWidget::SetValueAsBool(bool value) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index ea12756..462cb6e 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -110,7 +110,6 @@ const char* cmCursesCacheEntryComposite::GetValue() { if (this->Label) { return this->Label->GetValue(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 8ed3902..c9c8238 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -14,6 +14,8 @@ #include "cmCursesLabelWidget.h" +class cmake; + class cmCursesCacheEntryComposite { public: diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 3cd36af..a960090 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -18,7 +18,8 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, this->Type = cmState::INTERNAL; } -bool cmCursesDummyWidget::HandleInput(int&, cmCursesMainForm*, WINDOW*) +bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/, + WINDOW* /*w*/) { return false; } diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index e9da71e..784738b 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -25,7 +25,8 @@ cmCursesLabelWidget::~cmCursesLabelWidget() { } -bool cmCursesLabelWidget::HandleInput(int&, cmCursesMainForm*, WINDOW*) +bool cmCursesLabelWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/, + WINDOW* /*w*/) { // Static text. No input is handled here. return false; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 48cc42c..47f98a2 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -102,7 +102,8 @@ void cmCursesLongMessageForm::PrintKeys() pos_form_cursor(this->Form); } -void cmCursesLongMessageForm::Render(int, int, int, int) +void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/, + int /*height*/) { int x, y; getmaxyx(stdscr, y, x); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 964f3af..1d036c4 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -675,7 +675,7 @@ int cmCursesMainForm::Generate() return 0; } -void cmCursesMainForm::AddError(const char* message, const char*) +void cmCursesMainForm::AddError(const char* message, const char* /*unused*/) { this->Errors.push_back(message); } @@ -1028,7 +1028,7 @@ void cmCursesMainForm::HandleInput() } } -int cmCursesMainForm::LoadCache(const char*) +int cmCursesMainForm::LoadCache(const char* /*unused*/) { int r = this->CMakeInstance->LoadCache(); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 1a3a8c2..9a88aef 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -13,10 +13,7 @@ #include "cmCursesMainForm.h" -inline int ctrl(int z) -{ - return (z & 037); -} +#define ctrl(z) ((z)&037) cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) @@ -31,27 +28,30 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, field_opts_off(this->Field, O_STATIC); } -bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) +bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, + WINDOW* w) { - - // 10 == enter - if (key == 10 || key == KEY_ENTER) { - this->NextOption(); - touchwin(w); - wrefresh(w); - return true; - } else if (key == KEY_LEFT || key == ctrl('b')) { - touchwin(w); - wrefresh(w); - this->PreviousOption(); - return true; - } else if (key == KEY_RIGHT || key == ctrl('f')) { - this->NextOption(); - touchwin(w); - wrefresh(w); - return true; - } else { - return false; + switch (key) { + case 10: // 10 == enter + case KEY_ENTER: + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + case KEY_LEFT: + case ctrl('b'): + touchwin(w); + wrefresh(w); + this->PreviousOption(); + return true; + case KEY_RIGHT: + case ctrl('f'): + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + default: + return false; } } diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 46b8b86..db98a00 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -29,12 +29,13 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left, field_opts_off(this->Field, O_STATIC); } -void cmCursesStringWidget::OnTab(cmCursesMainForm*, WINDOW*) +void cmCursesStringWidget::OnTab(cmCursesMainForm* /*unused*/, + WINDOW* /*unused*/) { // FORM* form = fm->GetForm(); } -void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*) +void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW* /*unused*/) { FORM* form = fm->GetForm(); if (this->InEdit) { @@ -56,7 +57,8 @@ void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*) } } -void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm, WINDOW*) +void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm, + WINDOW* /*unused*/) { form_driver(fm->GetForm(), key); } @@ -92,10 +94,9 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, // quit if (key == 'q') { return false; - } else { - key = getch(); - continue; } + key = getch(); + continue; } // If resize occurred during edit, move out of edit mode @@ -205,7 +206,6 @@ bool cmCursesStringWidget::PrintKeys() curses_move(y - 3, 0); printw(fmt_s, "Editing option, press [enter] to leave edit."); return true; - } else { - return false; } + return false; } diff --git a/Source/QtDialog/CMakeSetup64.png b/Source/QtDialog/CMakeSetup64.png Binary files differnew file mode 100644 index 0000000..43a8cc6 --- /dev/null +++ b/Source/QtDialog/CMakeSetup64.png diff --git a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in new file mode 100644 index 0000000..e3d8554 --- /dev/null +++ b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in @@ -0,0 +1,21 @@ +// Component: CMake.Reference.DoxygenHTML + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/developer-reference/html/index.html", + installer.value("StartMenuDir") + "/CMake Developer Reference.lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index ceb7d31..8869040 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -16,7 +16,11 @@ #include "cm_get_date.h" #include <cm_libarchive.h> #include <cmsys/Directory.hxx> +#include <cmsys/Encoding.hxx> #include <cmsys/FStream.hxx> +#include <iostream> +#include <string.h> +#include <time.h> #ifndef __LA_SSIZE_T #define __LA_SSIZE_T la_ssize_t @@ -64,15 +68,15 @@ public: struct cmArchiveWrite::Callback { // archive_write_callback - static __LA_SSIZE_T Write(struct archive*, void* cd, const void* b, size_t n) + static __LA_SSIZE_T Write(struct archive* /*unused*/, void* cd, + const void* b, size_t n) { cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd); if (self->Stream.write(static_cast<const char*>(b), static_cast<std::streamsize>(n))) { return static_cast<__LA_SSIZE_T>(n); - } else { - return static_cast<__LA_SSIZE_T>(-1); } + return static_cast<__LA_SSIZE_T>(-1); } }; @@ -267,7 +271,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) } if (this->PermissionsMask.IsSet()) { - mode_t perm = archive_entry_perm(e); + int perm = archive_entry_perm(e); archive_entry_set_perm(e, perm & this->PermissionsMask.Get()); } diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index f847d09..120453b 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -12,7 +12,11 @@ #ifndef cmArchiveWrite_h #define cmArchiveWrite_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <iosfwd> +#include <stddef.h> +#include <string> #if !defined(CMAKE_BUILD_WITH_CMAKE) #error "cmArchiveWrite not allowed during bootstrap build!" @@ -94,7 +98,7 @@ public: void SetMTime(std::string const& t) { this->MTime = t; } //! Sets the permissions of the added files/folders - void SetPermissions(mode_t permissions_) + void SetPermissions(int permissions_) { this->Permissions.Set(permissions_); } @@ -107,7 +111,7 @@ public: //! The permissions will be copied from the existing file //! or folder. The mask will then be applied to unset //! some of them - void SetPermissionsMask(mode_t permissionsMask_) + void SetPermissionsMask(int permissionsMask_) { this->PermissionsMask.Set(permissionsMask_); } @@ -177,8 +181,8 @@ private: //!@} //! Permissions on files/folders - cmArchiveWriteOptional<mode_t> Permissions; - cmArchiveWriteOptional<mode_t> PermissionsMask; + cmArchiveWriteOptional<int> Permissions; + cmArchiveWriteOptional<int> PermissionsMask; }; #endif diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx index e4c74ec..e38f531 100644 --- a/Source/cmCLocaleEnvironmentScope.cxx +++ b/Source/cmCLocaleEnvironmentScope.cxx @@ -15,6 +15,7 @@ #include "cmSystemTools.h" #include <sstream> +#include <utility> cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope() { diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h index b011741..572beaf 100644 --- a/Source/cmCLocaleEnvironmentScope.h +++ b/Source/cmCLocaleEnvironmentScope.h @@ -13,7 +13,10 @@ #ifndef cmCLocaleEnvironmentScope_h #define cmCLocaleEnvironmentScope_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> class cmCLocaleEnvironmentScope { diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index af01c7d..ae6b0a1 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,8 +1,13 @@ #include "cmCPackPropertiesGenerator.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorExpression.h" +#include "cmInstalledFile.h" #include "cmOutputConverter.h" +#include <map> +#include <ostream> +#include <utility> + cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector<std::string> const& configurations) diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 4d092f6..77018b0 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -12,9 +12,15 @@ #ifndef cmCPackPropertiesGenerator_h #define cmCPackPropertiesGenerator_h -#include "cmInstalledFile.h" +#include <cmConfigure.h> // IWYU pragma: keep + #include "cmScriptGenerator.h" +#include <iosfwd> +#include <string> +#include <vector> + +class cmInstalledFile; class cmLocalGenerator; /** \class cmCPackPropertiesGenerator diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8a856a8..b4ddc3e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -781,13 +781,12 @@ bool cmCTest::SetTest(const char* ttype, bool report) if (p != PartCount) { this->Parts[p].Enable(); return true; - } else { - if (report) { - cmCTestLog(this, ERROR_MESSAGE, "Don't know about test \"" - << ttype << "\" yet..." << std::endl); - } - return false; } + if (report) { + cmCTestLog(this, ERROR_MESSAGE, "Don't know about test \"" + << ttype << "\" yet..." << std::endl); + } + return false; } void cmCTest::Finalize() diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index bdd7303..39d96b4 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -16,10 +16,12 @@ #include "cmVersion.h" #include "cmake.h" -#include <cmsys/Directory.hxx> +#include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> -#include <cmsys/RegularExpression.hxx> +#include <sstream> +#include <stdio.h> +#include <string.h> cmCacheManager::cmCacheManager() { @@ -574,7 +576,8 @@ const char* cmCacheManager::CacheEntry::GetProperty( { if (prop == "TYPE") { return cmState::CacheEntryTypeToString(this->Type); - } else if (prop == "VALUE") { + } + if (prop == "VALUE") { return this->Value.c_str(); } return this->Properties.GetPropertyValue(prop); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 2331867..3e32cf0 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -12,12 +12,19 @@ #ifndef cmCacheManager_h #define cmCacheManager_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmPropertyMap.h" #include "cmState.h" -class cmMarkAsAdvancedCommand; +#include <iosfwd> +#include <map> +#include <set> +#include <string> +#include <utility> +#include <vector> + +class cmake; /** \class cmCacheManager * \brief Control class for cmake's cache diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 42fb105..68111a0 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -75,9 +75,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, if (cmSystemTools::GetEnv(var, str)) { if (this->EscapeQuotes) { return this->AddString(cmSystemTools::EscapeQuotes(str.c_str())); - } else { - return this->AddString(str); } + return this->AddString(str); } return this->EmptyVariable; } @@ -86,9 +85,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, this->Makefile->GetState()->GetInitializedCacheValue(var)) { if (this->EscapeQuotes) { return this->AddString(cmSystemTools::EscapeQuotes(c)); - } else { - return this->AddString(c); } + return this->AddString(c); } return this->EmptyVariable; } @@ -162,7 +160,8 @@ char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2) { if (!in1) { return in2; - } else if (!in2) { + } + if (!in2) { return in1; } size_t len = strlen(in1) + strlen(in2) + 1; @@ -282,10 +281,9 @@ int cmCommandArgumentParserHelper::LexInput(char* buf, int maxlen) this->CurrentLine++; } return (1); - } else { - buf[0] = '\n'; - return (0); } + buf[0] = '\n'; + return (0); } void cmCommandArgumentParserHelper::Error(const char* str) diff --git a/Source/cmCommands.h b/Source/cmCommands.h index d0f1ab7..034c9c7 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -12,7 +12,7 @@ #ifndef cmCommands_h #define cmCommands_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include <vector> diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 7ad18f0..6167e2c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -11,13 +11,21 @@ ============================================================================*/ #include "cmCommonTargetGenerator.h" +#include <algorithm> +#include <cmConfigure.h> +#include <set> +#include <sstream> +#include <utility> + +#include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmGlobalCommonGenerator.h" #include "cmLocalCommonGenerator.h" +#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmSystemTools.h" +#include "cmState.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) : GeneratorTarget(gt) diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 0bafde9..d3f9d64 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -12,9 +12,13 @@ #ifndef cmCommonTargetGenerator_h #define cmCommonTargetGenerator_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" + +#include <map> +#include <string> +#include <vector> class cmGeneratorTarget; class cmGlobalCommonGenerator; diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index fb95f9a..cc468d9 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -12,11 +12,12 @@ #ifndef cmComputeComponentGraph_h #define cmComputeComponentGraph_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmGraphAdjacencyList.h" #include <stack> +#include <vector> /** \class cmComputeComponentGraph * \brief Analyze a graph to determine strongly connected components. diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index fffb77d..98405cf 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -13,13 +13,22 @@ #include "cmAlgorithms.h" #include "cmComputeComponentGraph.h" +#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" +#include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" +#include <algorithm> #include <assert.h> +#include <iterator> +#include <sstream> +#include <stdio.h> +#include <string.h> +#include <utility> /* diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 4a33aff..7cd4140 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -12,17 +12,22 @@ #ifndef cmComputeLinkDepends_h #define cmComputeLinkDepends_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmGraphAdjacencyList.h" #include "cmLinkItem.h" +#include "cmTargetLinkLibraryType.h" +#include <map> #include <queue> +#include <set> +#include <string> +#include <vector> class cmComputeComponentGraph; +class cmGeneratorTarget; class cmGlobalGenerator; class cmMakefile; -class cmGeneratorTarget; class cmake; /** \class cmComputeLinkDepends diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 7db5df3..82877f3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -11,19 +11,25 @@ ============================================================================*/ #include "cmComputeLinkInformation.h" -#include "cmComputeLinkDepends.h" -#include "cmOrderDirectories.h" - #include "cmAlgorithms.h" +#include "cmComputeLinkDepends.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmOrderDirectories.h" #include "cmOutputConverter.h" +#include "cmPolicies.h" #include "cmState.h" +#include "cmSystemTools.h" +#include "cmTarget.h" #include "cmake.h" +#include <algorithm> #include <ctype.h> +#include <sstream> +#include <string.h> +#include <utility> //#define CM_COMPUTE_LINK_INFO_DEBUG diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 023c781..7a67567 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -12,15 +12,19 @@ #ifndef cmComputeLinkInformation_h #define cmComputeLinkInformation_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include <cmsys/RegularExpression.hxx> +#include <iosfwd> +#include <set> +#include <string> +#include <vector> -class cmake; +class cmGeneratorTarget; class cmGlobalGenerator; class cmMakefile; -class cmGeneratorTarget; class cmOrderDirectories; +class cmake; /** \class cmComputeLinkInformation * \brief Compute link information for a target in one configuration. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index ff7eb0b..dd07300 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -12,18 +12,25 @@ #include "cmComputeTargetDepends.h" #include "cmComputeComponentGraph.h" +#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmLinkItem.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmPolicies.h" #include "cmSourceFile.h" #include "cmState.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmTargetDepend.h" #include "cmake.h" -#include <algorithm> - #include <assert.h> +#include <sstream> +#include <stdio.h> +#include <utility> + +class cmListFileBacktrace; /* diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 9e51d4d..587ac66 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -12,16 +12,19 @@ #ifndef cmComputeTargetDepends_h #define cmComputeTargetDepends_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmGraphAdjacencyList.h" -#include <stack> +#include <map> +#include <set> +#include <string> +#include <vector> class cmComputeComponentGraph; +class cmGeneratorTarget; class cmGlobalGenerator; class cmLinkItem; -class cmGeneratorTarget; class cmTargetDependSet; /** \class cmComputeTargetDepends diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 9bd07a3..8e2d87e 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -19,19 +19,23 @@ CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo) { if (strcmp(algo, "MD5") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashMD5); - } else if (strcmp(algo, "SHA1") == 0) { + } + if (strcmp(algo, "SHA1") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA1); - } else if (strcmp(algo, "SHA224") == 0) { + } + if (strcmp(algo, "SHA224") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA224); - } else if (strcmp(algo, "SHA256") == 0) { + } + if (strcmp(algo, "SHA256") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA256); - } else if (strcmp(algo, "SHA384") == 0) { + } + if (strcmp(algo, "SHA384") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA384); - } else if (strcmp(algo, "SHA512") == 0) { + } + if (strcmp(algo, "SHA512") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA512); - } else { - return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR); } + return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR); } bool cmCryptoHash::IntFromHexDigit(char input, char& output) @@ -39,10 +43,12 @@ bool cmCryptoHash::IntFromHexDigit(char input, char& output) if (input >= '0' && input <= '9') { output = char(input - '0'); return true; - } else if (input >= 'a' && input <= 'f') { + } + if (input >= 'a' && input <= 'f') { output = char(input - 'a' + 0xA); return true; - } else if (input >= 'A' && input <= 'F') { + } + if (input >= 'A' && input <= 'F') { output = char(input - 'A' + 0xA); return true; } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index b25e3ce..ce72eda 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -72,7 +72,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) return this->Finalize(makeDepends, internalDepends); } -bool cmDepends::Finalize(std::ostream&, std::ostream&) +bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) { return true; } @@ -123,9 +123,10 @@ void cmDepends::Clear(const char* file) << std::endl; } -bool cmDepends::WriteDependencies(const std::set<std::string>&, - const std::string&, std::ostream&, - std::ostream&) +bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/, + const std::string& /*unused*/, + std::ostream& /*unused*/, + std::ostream& /*unused*/) { // This should be implemented by the subclass. return false; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 9ea1e48..5c863f0 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -91,8 +91,9 @@ cmDependsFortran::~cmDependsFortran() } bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, - const std::string& obj, std::ostream&, - std::ostream&) + const std::string& obj, + std::ostream& /*makeDepends*/, + std::ostream& /*internalDepends*/) { // Make sure this is a scanning instance. if (sources.empty() || sources.begin()->empty()) { @@ -520,7 +521,8 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) } } return true; - } else if (cmSystemTools::FileExists(mod_lower.c_str(), true)) { + } + if (cmSystemTools::FileExists(mod_lower.c_str(), true)) { if (cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(), compilerId.c_str())) { if (!cmSystemTools::CopyFileAlways(mod_lower, stamp)) { diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 4f5e2ae..a9130e6 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -23,8 +23,9 @@ cmDependsJava::~cmDependsJava() } bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources, - const std::string&, std::ostream&, - std::ostream&) + const std::string& /*obj*/, + std::ostream& /*makeDepends*/, + std::ostream& /*internalDepends*/) { // Make sure this is a scanning instance. if (sources.empty() || sources.begin()->empty()) { @@ -35,8 +36,9 @@ bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources, return true; } -bool cmDependsJava::CheckDependencies(std::istream&, const char*, - std::map<std::string, DependencyVector>&) +bool cmDependsJava::CheckDependencies( + std::istream& /*internalDepends*/, const char* /*internalDependsFileName*/, + std::map<std::string, DependencyVector>& /*validDeps*/) { return true; } diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 919a45e..5516cf1 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -719,9 +719,8 @@ const char* cmDocumentation::GetNameString() const { if (!this->NameString.empty()) { return this->NameString.c_str(); - } else { - return "CMake"; } + return "CMake"; } bool cmDocumentation::IsOption(const char* arg) const diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 4c31733f..f6841ad 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -15,8 +15,10 @@ class cmDynamicLoaderCache { public: ~cmDynamicLoaderCache(); - void CacheFile(const char* path, const cmsys::DynamicLoader::LibraryHandle&); - bool GetCacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle&); + void CacheFile(const char* path, + const cmsys::DynamicLoader::LibraryHandle& /*p*/); + bool GetCacheFile(const char* path, + cmsys::DynamicLoader::LibraryHandle& /*p*/); bool FlushCache(const char* path); void FlushCache(); static cmDynamicLoaderCache* GetInstance(); diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 266b786..150593b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -55,17 +55,17 @@ template <size_t s> struct cmELFByteSwapSize { }; -void cmELFByteSwap(char*, cmELFByteSwapSize<1> const&) +void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> const& /*unused*/) { } -void cmELFByteSwap(char* data, cmELFByteSwapSize<2> const&) +void cmELFByteSwap(char* data, cmELFByteSwapSize<2> const& /*unused*/) { char one_byte; one_byte = data[0]; data[0] = data[1]; data[1] = one_byte; } -void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const&) +void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const& /*unused*/) { char one_byte; one_byte = data[0]; @@ -75,7 +75,7 @@ void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const&) data[1] = data[2]; data[2] = one_byte; } -void cmELFByteSwap(char* data, cmELFByteSwapSize<8> const&) +void cmELFByteSwap(char* data, cmELFByteSwapSize<8> const& /*unused*/) { char one_byte; one_byte = data[0]; @@ -832,45 +832,40 @@ cmELF::FileType cmELF::GetFileType() const { if (this->Valid()) { return this->Internal->GetFileType(); - } else { - return FileTypeInvalid; } + return FileTypeInvalid; } unsigned int cmELF::GetNumberOfSections() const { if (this->Valid()) { return this->Internal->GetNumberOfSections(); - } else { - return 0; } + return 0; } unsigned int cmELF::GetDynamicEntryCount() const { if (this->Valid()) { return this->Internal->GetDynamicEntryCount(); - } else { - return 0; } + return 0; } unsigned long cmELF::GetDynamicEntryPosition(int index) const { if (this->Valid()) { return this->Internal->GetDynamicEntryPosition(index); - } else { - return 0; } + return 0; } bool cmELF::ReadBytes(unsigned long pos, unsigned long size, char* buf) const { if (this->Valid()) { return this->Internal->ReadBytes(pos, size, buf); - } else { - return false; } + return false; } bool cmELF::GetSOName(std::string& soname) @@ -878,9 +873,8 @@ bool cmELF::GetSOName(std::string& soname) if (StringEntry const* se = this->GetSOName()) { soname = se->Value; return true; - } else { - return false; } + return false; } cmELF::StringEntry const* cmELF::GetSOName() @@ -888,9 +882,8 @@ cmELF::StringEntry const* cmELF::GetSOName() if (this->Valid() && this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary) { return this->Internal->GetSOName(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } cmELF::StringEntry const* cmELF::GetRPath() @@ -899,9 +892,8 @@ cmELF::StringEntry const* cmELF::GetRPath() (this->Internal->GetFileType() == cmELF::FileTypeExecutable || this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) { return this->Internal->GetRPath(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } cmELF::StringEntry const* cmELF::GetRunPath() @@ -910,9 +902,8 @@ cmELF::StringEntry const* cmELF::GetRunPath() (this->Internal->GetFileType() == cmELF::FileTypeExecutable || this->Internal->GetFileType() == cmELF::FileTypeSharedLibrary)) { return this->Internal->GetRunPath(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } void cmELF::PrintInfo(std::ostream& os) const diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index a53d285..390477a 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -211,11 +211,10 @@ void cmExportBuildFileGenerator::HandleMissingTarget( link_libs += missingTarget; missingTargets.push_back(missingTarget); return; - } else { - // We are not appending, so all exported targets should be - // known here. This is probably user-error. - this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences); } + // We are not appending, so all exported targets should be + // known here. This is probably user-error. + this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences); } // Assume the target will be exported by another command. // Append it with the export namespace. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e00af5e..7f01196 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -679,7 +679,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( } } -void cmExportFileGenerator::ReplaceInstallPrefix(std::string&) +void cmExportFileGenerator::ReplaceInstallPrefix(std::string& /*unused*/) { // Do nothing } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 38b08f0..7747157 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -468,7 +468,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget( } std::string cmExportInstallFileGenerator::InstallNameDir( - cmGeneratorTarget* target, const std::string&) + cmGeneratorTarget* target, const std::string& /*config*/) { std::string install_name_dir; diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 0771a4e..1a101ab 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -81,10 +81,9 @@ int cmExprParserHelper::LexInput(char* buf, int maxlen) this->CurrentLine++; } return (1); - } else { - buf[0] = '\n'; - return (0); } + buf[0] = '\n'; + return (0); } void cmExprParserHelper::Error(const char* str) diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index a527e50..b01290c 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -15,7 +15,8 @@ #include <assert.h> void cmExternalMakefileProjectGenerator::EnableLanguage( - std::vector<std::string> const&, cmMakefile*, bool) + std::vector<std::string> const& /*unused*/, cmMakefile* /*unused*/, + bool /*unused*/) { } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 0ded17a..559974e 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -124,11 +124,10 @@ void Tree::InsertPath(const std::vector<std::string>& splitted, if (start + 1 < splitted.size()) { it->InsertPath(splitted, start + 1, fileName); return; - } else { - // last part of splitted - it->files.push_back(fileName); - return; } + // last part of splitted + it->files.push_back(fileName); + return; } } // Not found in folders, thus insert @@ -138,12 +137,11 @@ void Tree::InsertPath(const std::vector<std::string>& splitted, newFolder.InsertPath(splitted, start + 1, fileName); folders.push_back(newFolder); return; - } else { - // last part of splitted - newFolder.files.push_back(fileName); - folders.push_back(newFolder); - return; } + // last part of splitted + newFolder.files.push_back(fileName); + folders.push_back(newFolder); + return; } void Tree::BuildVirtualFolder(cmXMLWriter& xml) const @@ -717,21 +715,22 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) // Translate the cmake target type into the CodeBlocks target type id int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target) { - if (target->GetType() == cmState::EXECUTABLE) { - if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) || - (target->GetPropertyAsBool("MACOSX_BUNDLE"))) { - return 0; - } else { + switch (target->GetType()) { + case cmState::EXECUTABLE: + if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) || + (target->GetPropertyAsBool("MACOSX_BUNDLE"))) { + return 0; + } return 1; - } - } else if ((target->GetType() == cmState::STATIC_LIBRARY) || - (target->GetType() == cmState::OBJECT_LIBRARY)) { - return 2; - } else if ((target->GetType() == cmState::SHARED_LIBRARY) || - (target->GetType() == cmState::MODULE_LIBRARY)) { - return 3; + case cmState::STATIC_LIBRARY: + case cmState::OBJECT_LIBRARY: + return 2; + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + return 3; + default: + return 4; } - return 4; } // Create the command line for building the given target using the selected diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 7a277c0..e617b08 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -77,7 +77,8 @@ cmExtraEclipseCDT4Generator::GetFactory() } void cmExtraEclipseCDT4Generator::EnableLanguage( - std::vector<std::string> const& languages, cmMakefile*, bool) + std::vector<std::string> const& languages, cmMakefile* /*unused*/, + bool /*optional*/) { for (std::vector<std::string>::const_iterator lit = languages.begin(); lit != languages.end(); ++lit) { diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5c909c8..6e81ee1 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -206,8 +206,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( void cmExtraSublimeTextGenerator::AppendTarget( cmGeneratedFileStream& fout, const std::string& targetName, cmLocalGenerator* lg, cmGeneratorTarget* target, const char* make, - const cmMakefile* makefile, - const char*, // compiler + const cmMakefile* makefile, const char* /*compiler*/, MapSourceFileFlags& sourceFileFlags, bool firstTarget) { diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx index 7c51459..5521ac4 100644 --- a/Source/cmFileLockPool.cxx +++ b/Source/cmFileLockPool.cxx @@ -140,10 +140,9 @@ cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename, if (result.IsOk()) { this->Locks.push_back(lock); return cmFileLockResult::MakeOk(); - } else { - delete lock; - return result; } + delete lock; + return result; } cmFileLockResult cmFileLockPool::ScopePool::Release( diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 9d63505..1360b44 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -140,11 +140,14 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1, // Compare using nanosecond resolution. if (s1->st_mtim.tv_sec < s2->st_mtim.tv_sec) { return -1; - } else if (s1->st_mtim.tv_sec > s2->st_mtim.tv_sec) { + } + if (s1->st_mtim.tv_sec > s2->st_mtim.tv_sec) { return 1; - } else if (s1->st_mtim.tv_nsec < s2->st_mtim.tv_nsec) { + } + if (s1->st_mtim.tv_nsec < s2->st_mtim.tv_nsec) { return -1; - } else if (s1->st_mtim.tv_nsec > s2->st_mtim.tv_nsec) { + } + if (s1->st_mtim.tv_nsec > s2->st_mtim.tv_nsec) { return 1; } #elif CMake_STAT_HAS_ST_MTIMESPEC @@ -185,11 +188,11 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1, long long t2 = s2->st_mtim.tv_sec * bil + s2->st_mtim.tv_nsec; if (t1 < t2) { return (t2 - t1) >= bil; - } else if (t2 < t1) { + } + if (t2 < t1) { return (t1 - t2) >= bil; - } else { - return false; } + return false; #elif CMake_STAT_HAS_ST_MTIMESPEC // Times are integers in units of 1ns. long long bil = 1000000000; @@ -240,11 +243,10 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1, // Compare the two modification times. *result = this->Compare(&s1, &s2); return true; - } else { - // No comparison available. Default to the same time. - *result = 0; - return false; } + // No comparison available. Default to the same time. + *result = 0; + return false; } bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1, @@ -256,8 +258,7 @@ bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1, if (this->Stat(f1, &s1) && this->Stat(f2, &s2)) { // Compare the two modification times. return this->TimesDiffer(&s1, &s2); - } else { - // No comparison available. Default to different times. - return true; } + // No comparison available. Default to different times. + return true; } diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index a72204a..30a33b4 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -22,29 +22,27 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir, if (cmSystemTools::FileIsFullPath(includeName)) { fileName = includeName; return cmSystemTools::FileExists(fileName.c_str(), true); - } else { - // Check for the file in the directory containing the including - // file. - std::string fullName = dir; + } + // Check for the file in the directory containing the including + // file. + std::string fullName = dir; + fullName += "/"; + fullName += includeName; + if (cmSystemTools::FileExists(fullName.c_str(), true)) { + fileName = fullName; + return true; + } + + // Search the include path for the file. + for (std::vector<std::string>::const_iterator i = this->IncludePath.begin(); + i != this->IncludePath.end(); ++i) { + fullName = *i; fullName += "/"; fullName += includeName; if (cmSystemTools::FileExists(fullName.c_str(), true)) { fileName = fullName; return true; } - - // Search the include path for the file. - for (std::vector<std::string>::const_iterator i = - this->IncludePath.begin(); - i != this->IncludePath.end(); ++i) { - fullName = *i; - fullName += "/"; - fullName += includeName; - if (cmSystemTools::FileExists(fullName.c_str(), true)) { - fileName = fullName; - return true; - } - } } return false; } @@ -88,9 +86,8 @@ bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) cmFortran_yy_switch_to_buffer(buffer, parser->Scanner); parser->FileStack.push(f); return 1; - } else { - return 0; } + return 0; } bool cmFortranParser_FilePop(cmFortranParser* parser) @@ -99,15 +96,14 @@ bool cmFortranParser_FilePop(cmFortranParser* parser) // to the next one on the stack. if (parser->FileStack.empty()) { return 0; - } else { - cmFortranFile f = parser->FileStack.top(); - parser->FileStack.pop(); - fclose(f.File); - YY_BUFFER_STATE current = cmFortranLexer_GetCurrentBuffer(parser->Scanner); - cmFortran_yy_delete_buffer(current, parser->Scanner); - cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); - return 1; } + cmFortranFile f = parser->FileStack.top(); + parser->FileStack.pop(); + fclose(f.File); + YY_BUFFER_STATE current = cmFortranLexer_GetCurrentBuffer(parser->Scanner); + cmFortran_yy_delete_buffer(current, parser->Scanner); + cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); + return 1; } int cmFortranParser_Input(cmFortranParser* parser, char* buffer, @@ -161,7 +157,7 @@ int cmFortranParser_GetOldStartcond(cmFortranParser* parser) return parser->OldStartcond; } -void cmFortranParser_Error(cmFortranParser*, const char*) +void cmFortranParser_Error(cmFortranParser* /*unused*/, const char* /*unused*/) { // If there is a parser error just ignore it. The source will not // compile and the user will edit it. Then dependencies will have diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 983bfb4..6cd6439 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -352,7 +352,8 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input, { if (context == StripAllGeneratorExpressions) { return stripAllGeneratorExpressions(input); - } else if (context == BuildInterface || context == InstallInterface) { + } + if (context == BuildInterface || context == InstallInterface) { return stripExportInterface(input, context, resolveRelative); } diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c700156..045ded1 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -198,7 +198,7 @@ enum TransitiveProperty }; template <TransitiveProperty> -bool additionalTest(const char* const) +bool additionalTest(const char* const /*unused*/) { return false; } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 66437eb..b4b74c5 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -154,20 +154,19 @@ std::string GeneratorExpressionContent::EvaluateParameters( node, identifier, context, dagChecker, pit); parameters.push_back(lastParam); return std::string(); - } else { - std::string parameter; - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - pit->begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator - end = pit->end(); - for (; it != end; ++it) { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) { - return std::string(); - } + } + std::string parameter; + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = + pit->begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = + pit->end(); + for (; it != end; ++it) { + parameter += (*it)->Evaluate(context, dagChecker); + if (context->HadError) { + return std::string(); } - parameters.push_back(parameter); } + parameters.push_back(parameter); } } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6e2b16a..12cf980 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -46,10 +46,11 @@ static const struct ZeroNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } - std::string Evaluate(const std::vector<std::string>&, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + std::string Evaluate(const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return std::string(); } @@ -62,9 +63,10 @@ static const struct OneNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return parameters.front(); } @@ -90,7 +92,8 @@ static const struct ZeroNode installInterfaceNode; for (; it != end; ++it) { \ if (*it == #FAILURE_VALUE) { \ return #FAILURE_VALUE; \ - } else if (*it != #SUCCESS_VALUE) { \ + } \ + if (*it != #SUCCESS_VALUE) { \ reportError(context, content->GetOriginalExpression(), \ "Parameters to $<" #OP \ "> must resolve to either '0' or '1'."); \ @@ -113,7 +116,8 @@ static const struct NotNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { if (*parameters.begin() != "0" && *parameters.begin() != "1") { reportError( @@ -132,9 +136,10 @@ static const struct BoolNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; } @@ -147,9 +152,10 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return *parameters.begin() == parameters[1] ? "1" : "0"; } @@ -164,7 +170,8 @@ static const struct EqualNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { char* pEnd; @@ -239,9 +246,10 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::LowerCase(parameters.front()); } @@ -254,9 +262,10 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::UpperCase(parameters.front()); } @@ -269,9 +278,10 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::MakeCidentifier(parameters.front()); } @@ -283,10 +293,11 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 0; } - std::string Evaluate(const std::vector<std::string>&, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + std::string Evaluate(const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return ">"; } @@ -298,10 +309,11 @@ static const struct CommaNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 0; } - std::string Evaluate(const std::vector<std::string>&, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + std::string Evaluate(const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return ","; } @@ -313,10 +325,11 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 0; } - std::string Evaluate(const std::vector<std::string>&, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + std::string Evaluate(const std::vector<std::string>& /*parameters*/, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return ";"; } @@ -331,7 +344,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*, + cmGeneratorExpressionDAGChecker* /*unused*/, const std::string& lang) const { const char* compilerId = context->LG->GetMakefile()->GetSafeDefinition( @@ -426,7 +439,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*, + cmGeneratorExpressionDAGChecker* /*unused*/, const std::string& lang) const { const char* compilerVersion = @@ -506,8 +519,9 @@ struct PlatformIdNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { const char* platformId = context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME"); @@ -533,9 +547,10 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, parameters.front().c_str(), @@ -552,9 +567,10 @@ static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, parameters.front().c_str(), @@ -571,9 +587,10 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, parameters.front().c_str(), @@ -590,9 +607,10 @@ static const struct VersionLessEqNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS_EQUAL, parameters.front().c_str(), @@ -609,9 +627,10 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, parameters.front().c_str(), @@ -625,10 +644,11 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode { LinkOnlyNode() {} - std::string Evaluate( - const std::vector<std::string>& parameters, cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker* dagChecker) const CM_OVERRIDE + std::string Evaluate(const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!dagChecker->GetTransitivePropertiesOnly()) { return parameters.front(); @@ -643,10 +663,11 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode int NumExpectedParameters() const CM_OVERRIDE { return 0; } - std::string Evaluate(const std::vector<std::string>&, + std::string Evaluate(const std::vector<std::string>& /*parameters*/, cmGeneratorExpressionContext* context, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { context->HadContextSensitiveCondition = true; return context->Config; @@ -662,7 +683,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { if (parameters.empty()) { return configurationNode.Evaluate(parameters, context, content, @@ -721,9 +743,10 @@ static const struct JoinNode : public cmGeneratorExpressionNode bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { std::vector<std::string> list; cmSystemTools::ExpandListArgument(parameters.front(), list); @@ -768,7 +791,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "$<COMPILE_LANGUAGE:...> may not be used with Visual Studio " "generators."); return std::string(); - } else if (genName.find("Xcode") != std::string::npos) { + } + if (genName.find("Xcode") != std::string::npos) { if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || dagChecker->EvaluatingIncludeDirectories())) { reportError( @@ -1138,9 +1162,10 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode bool RequiresLiteralInput() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector<std::string>& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { return parameters.front(); } @@ -1156,7 +1181,8 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { if (!context->EvaluateForBuildsystem) { std::ostringstream e; @@ -1357,7 +1383,8 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -1414,10 +1441,11 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode bool GeneratesContent() const CM_OVERRIDE { return true; } int NumExpectedParameters() const CM_OVERRIDE { return 0; } - std::string Evaluate(const std::vector<std::string>&, + std::string Evaluate(const std::vector<std::string>& /*parameters*/, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { reportError(context, content->GetOriginalExpression(), "INSTALL_PREFIX is a marker for install(EXPORT) only. It " @@ -1534,7 +1562,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactNameTag> { static std::string Create(cmGeneratorTarget* target, cmGeneratorExpressionContext* context, - const GeneratorExpressionContent*) + const GeneratorExpressionContent* /*unused*/) { return target->GetFullPath(context->Config, false, true); } @@ -1653,7 +1681,8 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const + CM_OVERRIDE { if (!cmSystemTools::FileIsFullPath(parameters.front())) { reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 793ad2e..8bd3b82 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -128,7 +128,7 @@ template <bool> struct DoAccept { template <typename T> - static void Do(T&, cmSourceFile*) + static void Do(T& /*unused*/, cmSourceFile* /*unused*/) { } }; @@ -361,10 +361,9 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const if (implib) { // A DLL import library is treated as an archive target. return "ARCHIVE"; - } else { - // A DLL shared library is treated as a runtime target. - return "RUNTIME"; } + // A DLL shared library is treated as a runtime target. + return "RUNTIME"; } else { // For non-DLL platforms shared libraries are treated as // library targets. @@ -1324,26 +1323,23 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const // The imported library has no builtin soname so the name // searched at runtime will be just the filename. return cmSystemTools::GetFilenameName(info->Location); - } else { - // Use the soname given if any. - if (info->SOName.find("@rpath/") == 0) { - return info->SOName.substr(6); - } - return info->SOName; } - } else { - return ""; + // Use the soname given if any. + if (info->SOName.find("@rpath/") == 0) { + return info->SOName.substr(6); + } + return info->SOName; } - } else { - // Compute the soname that will be built. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - this->GetLibraryNames(name, soName, realName, impName, pdbName, config); - return soName; + return ""; } + // Compute the soname that will be built. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + this->GetLibraryNames(name, soName, realName, impName, pdbName, config); + return soName; } std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, @@ -1418,9 +1414,8 @@ std::string cmGeneratorTarget::GetFullName(const std::string& config, { if (this->IsImported()) { return this->GetFullNameImported(config, implib); - } else { - return this->GetFullNameInternal(config, implib); } + return this->GetFullNameInternal(config, implib); } std::string cmGeneratorTarget::GetInstallNameDirForBuildTree( @@ -1444,9 +1439,8 @@ std::string cmGeneratorTarget::GetInstallNameDirForBuildTree( } dir += "/"; return dir; - } else { - return ""; } + return ""; } std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const @@ -1468,9 +1462,8 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const } } return dir; - } else { - return ""; } + return ""; } cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const @@ -1516,9 +1509,8 @@ const char* cmGeneratorTarget::GetExportMacro() const this->ExportMacro = cmSystemTools::MakeCidentifier(in); } return this->ExportMacro.c_str(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } class cmTargetCollectLinkLanguages @@ -1642,7 +1634,8 @@ public: { if (this->Preferred.empty()) { return ""; - } else if (this->Preferred.size() > 1) { + } + if (this->Preferred.size() > 1) { std::ostringstream e; e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" @@ -2723,9 +2716,8 @@ std::string cmGeneratorTarget::GetFullPath(const std::string& config, { if (this->IsImported()) { return this->Target->ImportedGetFullPath(config, implib); - } else { - return this->NormalGetFullPath(config, implib, realname); } + return this->NormalGetFullPath(config, implib, realname); } std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config, @@ -2770,16 +2762,15 @@ std::string cmGeneratorTarget::NormalGetRealName( std::string pdbName; this->GetExecutableNames(name, realName, impName, pdbName, config); return realName; - } else { - // Compute the real name that will be built. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - this->GetLibraryNames(name, soName, realName, impName, pdbName, config); - return realName; } + // Compute the real name that will be built. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + this->GetLibraryNames(name, soName, realName, impName, pdbName, config); + return realName; } void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName, @@ -3271,7 +3262,8 @@ template <> bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt, const std::string& prop, const std::string& config, - CompatibleType, bool*) + CompatibleType /*unused*/, + bool* /*unused*/) { return tgt->GetLinkInterfaceDependentBoolProperty(prop, config); } @@ -3280,7 +3272,8 @@ template <> const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt, const std::string& prop, const std::string& config, - CompatibleType t, const char**) + CompatibleType t, + const char** /*unused*/) { switch (t) { case BoolType: @@ -3303,7 +3296,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender, const std::string& propName, std::set<std::string>& emitted, const std::string& config, CompatibleType t, - PropertyType*) + PropertyType* /*unused*/) { const char* prop = dependee->GetProperty(propName); if (!prop) { @@ -3536,12 +3529,12 @@ std::string valueAsString<const char*>(const char* value) template <typename PropertyType> PropertyType impliedValue(PropertyType); template <> -bool impliedValue<bool>(bool) +bool impliedValue<bool>(bool /*unused*/) { return false; } template <> -const char* impliedValue<const char*>(const char*) +const char* impliedValue<const char*>(const char* /*unused*/) { return ""; } @@ -3552,7 +3545,8 @@ std::pair<bool, PropertyType> consistentProperty(PropertyType lhs, CompatibleType t); template <> -std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType) +std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, + CompatibleType /*unused*/) { return std::make_pair(lhs == rhs, lhs); } @@ -3584,9 +3578,8 @@ std::pair<bool, const char*> consistentNumberProperty(const char* lhs, if (t == NumberMaxType) { return std::make_pair(true, std::max(lnum, rnum) == lnum ? lhs : rhs); - } else { - return std::make_pair(true, std::min(lnum, rnum) == lnum ? lhs : rhs); } + return std::make_pair(true, std::min(lnum, rnum) == lnum ? lhs : rhs); } template <> @@ -3626,7 +3619,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, const std::string& config, const char* defaultValue, CompatibleType t, - PropertyType*) + PropertyType* /*unused*/) { PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); std::vector<std::string> headPropKeys = tgt->GetPropertyKeys(); @@ -3903,11 +3896,11 @@ std::string cmGeneratorTarget::GetFrameworkVersion() const if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) { return fversion; - } else if (const char* tversion = this->GetProperty("VERSION")) { + } + if (const char* tversion = this->GetProperty("VERSION")) { return tversion; - } else { - return "A"; } + return "A"; } void cmGeneratorTarget::ComputeVersionedName(std::string& vName, @@ -4166,7 +4159,8 @@ std::string cmGeneratorTarget::GetDirectory(const std::string& config, // Return the directory from which the target is imported. return cmSystemTools::GetFilenamePath( this->Target->ImportedGetFullPath(config, implib)); - } else if (OutputInfo const* info = this->GetOutputInfo(config)) { + } + if (OutputInfo const* info = this->GetOutputInfo(config)) { // Return the directory in which the target will be built. return implib ? info->ImpDir : info->OutDir; } diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 92a1109..118cae6 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -16,13 +16,13 @@ #include "cmTarget.h" +class cmCustomCommand; class cmGeneratedFileStream; +class cmGeneratorTarget; class cmGlobalGhsMultiGenerator; class cmLocalGhsMultiGenerator; class cmMakefile; class cmSourceFile; -class cmGeneratedFileStream; -class cmCustomCommand; class cmGhsMultiTargetGenerator { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3ec16c0..295f65b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1515,7 +1515,8 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->BinaryDirectories.clear(); } -void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const +void cmGlobalGenerator::ComputeTargetObjectDirectory( + cmGeneratorTarget* /*unused*/) const { } @@ -1644,15 +1645,17 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, } void cmGlobalGenerator::GenerateBuildCommand( - std::vector<std::string>& makeCommand, const std::string&, - const std::string&, const std::string&, const std::string&, - const std::string&, bool, bool, std::vector<std::string> const&) + std::vector<std::string>& makeCommand, const std::string& /*unused*/, + const std::string& /*unused*/, const std::string& /*unused*/, + const std::string& /*unused*/, const std::string& /*unused*/, + bool /*unused*/, bool /*unused*/, std::vector<std::string> const& /*unused*/) { makeCommand.push_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); } -int cmGlobalGenerator::Build(const std::string&, const std::string& bindir, +int cmGlobalGenerator::Build(const std::string& /*unused*/, + const std::string& bindir, const std::string& projectName, const std::string& target, std::string& output, const std::string& makeCommandCSTR, @@ -2372,10 +2375,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( return ""; } -void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&, - const std::string&, - const std::string&, - std::string&) +void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/, + const std::string& /*unused*/, + const std::string& /*unused*/, + std::string& /*unused*/) { // Subclasses that support multiple configurations should implement // this method to append the subdirectory for the given build diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3b8aaa6..2b83479 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -93,12 +93,11 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string& ident, names << "ident" << VarNum++; vars << names.str() << " = " << ident << "\n"; return "$" + names.str(); - } else { - std::string result = ident; - cmSystemTools::ReplaceString(result, " ", "$ "); - cmSystemTools::ReplaceString(result, ":", "$:"); - return result; } + std::string result = ident; + cmSystemTools::ReplaceString(result, " ", "$ "); + cmSystemTools::ReplaceString(result, ":", "$:"); + return result; } std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit) diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 0fcd8ba..72c4d1f 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -63,9 +63,8 @@ void cmInstallExportGenerator::ComputeTempDir() this->TempDir += "/Export"; if (this->Destination.empty()) { return; - } else { - this->TempDir += "/"; } + this->TempDir += "/"; // Enforce a maximum length. bool useMD5 = false; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 28b3781..1967d2a 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -259,10 +259,9 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, if (isError) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); return false; - } else { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str()); - return true; } + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + return true; } struct cmListFileBacktrace::Entry : public cmListFileContext @@ -377,10 +376,9 @@ cmListFileContext const& cmListFileBacktrace::Top() const { if (this->Cur) { return *this->Cur; - } else { - static cmListFileContext const empty; - return empty; } + static cmListFileContext const empty; + return empty; } void cmListFileBacktrace::PrintTitle(std::ostream& out) const diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2f29791..d8f6bdf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -626,16 +626,14 @@ std::string cmLocalGenerator::ExpandRuleVariable( if (variable == "TARGET_VERSION_MAJOR") { if (replaceValues.TargetVersionMajor) { return replaceValues.TargetVersionMajor; - } else { - return "0"; } + return "0"; } if (variable == "TARGET_VERSION_MINOR") { if (replaceValues.TargetVersionMinor) { return replaceValues.TargetVersionMinor; - } else { - return "0"; } + return "0"; } if (replaceValues.Target) { if (variable == "TARGET_BASE") { @@ -644,9 +642,8 @@ std::string cmLocalGenerator::ExpandRuleVariable( std::string::size_type pos = targetBase.rfind('.'); if (pos != targetBase.npos) { return targetBase.substr(0, pos); - } else { - return targetBase; } + return targetBase; } } } @@ -813,9 +810,8 @@ const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, { if (target) { return target->GetProperty(prop); - } else { - return this->Makefile->GetProperty(prop); } + return this->Makefile->GetProperty(prop); } void cmLocalGenerator::InsertRuleLauncher(std::string& s, @@ -1371,8 +1367,8 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, this->AddCompileDefinitions(defines, target, config, lang.c_str()); } -std::string cmLocalGenerator::GetTargetFortranFlags(cmGeneratorTarget const*, - std::string const&) +std::string cmLocalGenerator::GetTargetFortranFlags( + cmGeneratorTarget const* /*unused*/, std::string const& /*unused*/) { // Implemented by specific generators that override this. return std::string(); @@ -2365,10 +2361,9 @@ static bool cmLocalGeneratorShortenObjectName(std::string& objName, // The object name is now short enough. return true; - } else { - // The object name could not be shortened enough. - return false; } + // The object name could not be shortened enough. + return false; } bool cmLocalGeneratorCheckObjectName(std::string& objName, @@ -2382,15 +2377,13 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName, if (objName.size() > max_obj_len) { // The current object file name is too long. Try to shorten it. return cmLocalGeneratorShortenObjectName(objName, max_obj_len); - } else { - // The object file name is short enough. - return true; } - } else { - // The build directory in which the object will be stored is - // already too deep. - return false; + // The object file name is short enough. + return true; } + // The build directory in which the object will be stored is + // already too deep. + return false; } #endif @@ -2478,7 +2471,8 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName( } void cmLocalGenerator::ComputeObjectFilenames( - std::map<cmSourceFile const*, std::string>&, cmGeneratorTarget const*) + std::map<cmSourceFile const*, std::string>& /*unused*/, + cmGeneratorTarget const* /*unused*/) { } @@ -2613,7 +2607,7 @@ const char* cmLocalGenerator::GetCurrentSourceDirectory() const } std::string cmLocalGenerator::GetTargetDirectory( - const cmGeneratorTarget*) const + const cmGeneratorTarget* /*unused*/) const { cmSystemTools::Error("GetTargetDirectory" " called on cmLocalGenerator"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ab7de57..28a3ab5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -813,11 +813,10 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( // The existing custom command is identical. Silently ignore // the duplicate. return file; - } else { - // The existing custom command is different. We need to - // generate a rule file for this new command. - file = CM_NULLPTR; } + // The existing custom command is different. We need to + // generate a rule file for this new command. + file = CM_NULLPTR; } else if (!file) { file = this->CreateSource(main_dependency); } @@ -2029,7 +2028,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, sg->SetGroupRegex(regex); } return; - } else if (i == -1) { + } + if (i == -1) { // group does not exist nor belong to any existing group // add its first component this->SourceGroups.push_back(cmSourceGroup(name[0].c_str(), regex)); @@ -2817,13 +2817,12 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, cmSystemTools::ExpandListArgument(configTypes, configs); } return ""; - } else { - const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); - if (singleConfig && !buildType.empty()) { - configs.push_back(buildType); - } - return buildType; } + const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if (singleConfig && !buildType.empty()) { + configs.push_back(buildType); + } + return buildType; } #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -3129,9 +3128,8 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, { if (cmSourceFile* esf = this->GetSource(sourceName)) { return esf; - } else { - return this->CreateSource(sourceName, generated); } + return this->CreateSource(sourceName, generated); } void cmMakefile::EnableLanguage(std::vector<std::string> const& lang, @@ -3756,69 +3754,67 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, << "\" because an imported target with the same name already exists."; msg = e.str(); return false; - } else { - // target names must be globally unique - switch (this->GetPolicyStatus(cmPolicies::CMP0002)) { - case cmPolicies::WARN: - this->IssueMessage( - cmake::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0002)); - case cmPolicies::OLD: - return true; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - this->IssueMessage( - cmake::FATAL_ERROR, - cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002)); - return true; - case cmPolicies::NEW: - break; - } - - // The conflict is with a non-imported target. - // Allow this if the user has requested support. - cmake* cm = this->GetCMakeInstance(); - if (isCustom && existing->GetType() == cmState::UTILITY && - this != existing->GetMakefile() && - cm->GetState()->GetGlobalPropertyAsBool( - "ALLOW_DUPLICATE_CUSTOM_TARGETS")) { + } + // target names must be globally unique + switch (this->GetPolicyStatus(cmPolicies::CMP0002)) { + case cmPolicies::WARN: + this->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0002)); + case cmPolicies::OLD: return true; - } + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + this->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002)); + return true; + case cmPolicies::NEW: + break; + } - // Produce an error that tells the user how to work around the - // problem. - std::ostringstream e; - e << "cannot create target \"" << name - << "\" because another target with the same name already exists. " - << "The existing target is "; - switch (existing->GetType()) { - case cmState::EXECUTABLE: - e << "an executable "; - break; - case cmState::STATIC_LIBRARY: - e << "a static library "; - break; - case cmState::SHARED_LIBRARY: - e << "a shared library "; - break; - case cmState::MODULE_LIBRARY: - e << "a module library "; - break; - case cmState::UTILITY: - e << "a custom target "; - break; - case cmState::INTERFACE_LIBRARY: - e << "an interface library "; - break; - default: - break; - } - e << "created in source directory \"" - << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". " - << "See documentation for policy CMP0002 for more details."; - msg = e.str(); - return false; + // The conflict is with a non-imported target. + // Allow this if the user has requested support. + cmake* cm = this->GetCMakeInstance(); + if (isCustom && existing->GetType() == cmState::UTILITY && + this != existing->GetMakefile() && + cm->GetState()->GetGlobalPropertyAsBool( + "ALLOW_DUPLICATE_CUSTOM_TARGETS")) { + return true; + } + + // Produce an error that tells the user how to work around the + // problem. + std::ostringstream e; + e << "cannot create target \"" << name + << "\" because another target with the same name already exists. " + << "The existing target is "; + switch (existing->GetType()) { + case cmState::EXECUTABLE: + e << "an executable "; + break; + case cmState::STATIC_LIBRARY: + e << "a static library "; + break; + case cmState::SHARED_LIBRARY: + e << "a shared library "; + break; + case cmState::MODULE_LIBRARY: + e << "a module library "; + break; + case cmState::UTILITY: + e << "a custom target "; + break; + case cmState::INTERFACE_LIBRARY: + e << "an interface library "; + break; + default: + break; } + e << "created in source directory \"" + << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". " + << "See documentation for policy CMP0002 for more details."; + msg = e.str(); + return false; } return true; } @@ -4246,15 +4242,15 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, existingCIt < std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS), cmStrCmp("11"))) { return false; - } else if (needC99 && existingCStandard && - existingCIt < std::find_if(cmArrayBegin(C_STANDARDS), - cmArrayEnd(C_STANDARDS), - cmStrCmp("99"))) { + } + if (needC99 && existingCStandard && + existingCIt < std::find_if(cmArrayBegin(C_STANDARDS), + cmArrayEnd(C_STANDARDS), cmStrCmp("99"))) { return false; - } else if (needC90 && existingCStandard && - existingCIt < std::find_if(cmArrayBegin(C_STANDARDS), - cmArrayEnd(C_STANDARDS), - cmStrCmp("90"))) { + } + if (needC90 && existingCStandard && + existingCIt < std::find_if(cmArrayBegin(C_STANDARDS), + cmArrayEnd(C_STANDARDS), cmStrCmp("90"))) { return false; } return true; @@ -4332,10 +4328,11 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, cmArrayEnd(CXX_STANDARDS), cmStrCmp("11"))) { return false; - } else if (needCxx98 && - existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), - cmArrayEnd(CXX_STANDARDS), - cmStrCmp("98"))) { + } + if (needCxx98 && + existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), + cmArrayEnd(CXX_STANDARDS), + cmStrCmp("98"))) { return false; } return true; diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx index c03f60d..d64993a 100644 --- a/Source/cmNewLineStyle.cxx +++ b/Source/cmNewLineStyle.cxx @@ -34,19 +34,18 @@ bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args, if (eol == "LF" || eol == "UNIX") { NewLineStyle = LF; return true; - } else if (eol == "CRLF" || eol == "WIN32" || eol == "DOS") { + } + if (eol == "CRLF" || eol == "WIN32" || eol == "DOS") { NewLineStyle = CRLF; return true; - } else { - errorString = "NEWLINE_STYLE sets an unknown style, only LF, " - "CRLF, UNIX, DOS, and WIN32 are supported"; - return false; } - } else { - errorString = "NEWLINE_STYLE must set a style: " - "LF, CRLF, UNIX, DOS, or WIN32"; + errorString = "NEWLINE_STYLE sets an unknown style, only LF, " + "CRLF, UNIX, DOS, and WIN32 are supported"; return false; } + errorString = "NEWLINE_STYLE must set a style: " + "LF, CRLF, UNIX, DOS, or WIN32"; + return false; } } return true; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 124fb6a..c456d88 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -293,7 +293,8 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) } ///! Get the default status for a policy -cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus(cmPolicies::PolicyID) +cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus( + cmPolicies::PolicyID /*unused*/) { return cmPolicies::WARN; } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 28bd992..f1da4d5 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -347,7 +347,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target) return std::string(); } return qt5Rcc->ImportedGetLocation(""); - } else if (strcmp(qtVersion, "4") == 0) { + } + if (strcmp(qtVersion, "4") == 0) { cmGeneratorTarget* qt4Rcc = lg->FindGeneratorTargetToUse("Qt4::rcc"); if (!qt4Rcc) { cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str()); diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index b8aae5d..a000258 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -117,9 +117,9 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, } } -void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, - const std::string&, - Indent const&) +void cmScriptGenerator::GenerateScriptForConfig(std::ostream& /*unused*/, + const std::string& /*unused*/, + Indent const& /*unused*/) { // No actions for this generator. } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 04727b2..5869a01 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -295,9 +295,8 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const if (prop == "LOCATION") { if (this->FullPath.empty()) { return CM_NULLPTR; - } else { - return this->FullPath.c_str(); } + return this->FullPath.c_str(); } const char* retVal = this->Properties.GetPropertyValue(prop); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 0470508..073c239 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -15,10 +15,19 @@ #include "cmCacheManager.h" #include "cmCommand.h" #include "cmDefinitions.h" +#include "cmListFileCache.h" +#include "cmSystemTools.h" +#include "cmTypeMacro.h" #include "cmVersion.h" #include "cmake.h" +#include <algorithm> #include <assert.h> +#include <cmsys/RegularExpression.hxx> +#include <iterator> +#include <stdio.h> +#include <string.h> +#include <utility> struct cmState::SnapshotDataType { @@ -1693,7 +1702,8 @@ const char* cmState::Directory::GetProperty(const std::string& prop, return parent.GetDirectory().GetCurrentSource(); } return ""; - } else if (prop == "LISTFILE_STACK") { + } + if (prop == "LISTFILE_STACK") { std::vector<std::string> listFiles; cmState::Snapshot snp = this->Snapshot_; while (snp.IsValid()) { @@ -1703,10 +1713,12 @@ const char* cmState::Directory::GetProperty(const std::string& prop, std::reverse(listFiles.begin(), listFiles.end()); output = cmJoin(listFiles, ";"); return output.c_str(); - } else if (prop == "CACHE_VARIABLES") { + } + if (prop == "CACHE_VARIABLES") { output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";"); return output.c_str(); - } else if (prop == "VARIABLES") { + } + if (prop == "VARIABLES") { std::vector<std::string> res = this->Snapshot_.ClosureKeys(); std::vector<std::string> cacheKeys = this->Snapshot_.State->GetCacheEntryKeys(); @@ -1714,13 +1726,16 @@ const char* cmState::Directory::GetProperty(const std::string& prop, std::sort(res.begin(), res.end()); output = cmJoin(res, ";"); return output.c_str(); - } else if (prop == "INCLUDE_DIRECTORIES") { + } + if (prop == "INCLUDE_DIRECTORIES") { output = cmJoin(this->GetIncludeDirectoriesEntries(), ";"); return output.c_str(); - } else if (prop == "COMPILE_OPTIONS") { + } + if (prop == "COMPILE_OPTIONS") { output = cmJoin(this->GetCompileOptionsEntries(), ";"); return output.c_str(); - } else if (prop == "COMPILE_DEFINITIONS") { + } + if (prop == "COMPILE_DEFINITIONS") { output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); return output.c_str(); } diff --git a/Source/cmState.h b/Source/cmState.h index e5f9917..9ab4213 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -12,19 +12,25 @@ #ifndef cmState_h #define cmState_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmAlgorithms.h" +#include "cmDefinitions.h" #include "cmLinkedTree.h" #include "cmPolicies.h" +#include "cmProperty.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" -class cmake; +#include <map> +#include <set> +#include <string> +#include <vector> + +class cmCacheManager; class cmCommand; -class cmDefinitions; class cmListFileBacktrace; -class cmCacheManager; +class cmPropertyDefinition; class cmState { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5745a01..21a50cb 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -191,7 +191,8 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64 view) } } #else -void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64) +void cmSystemTools::ExpandRegistryValues(std::string& source, + KeyWOW64 /*unused*/) { cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]"); while (regEntry.find(source)) { @@ -332,9 +333,8 @@ void cmSystemTools::Message(const char* m1, const char* title) (*s_MessageCallback)(m1, title, s_DisableMessages, s_MessageCallbackClientData); return; - } else { - std::cerr << m1 << std::endl << std::flush; } + std::cerr << m1 << std::endl << std::flush; } void cmSystemTools::ReportLastSystemError(const char* msg) @@ -1687,7 +1687,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, if (pipe == cmsysProcess_Pipe_Timeout) { // Timeout has been exceeded. return pipe; - } else if (pipe == cmsysProcess_Pipe_STDOUT) { + } + if (pipe == cmsysProcess_Pipe_STDOUT) { // Append to the stdout buffer. std::vector<char>::size_type size = out.size(); out.insert(out.end(), data, data + length); @@ -1703,13 +1704,13 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, line.append(&out[0], outiter - out.begin()); out.erase(out.begin(), out.end()); return cmsysProcess_Pipe_STDOUT; - } else if (!err.empty()) { + } + if (!err.empty()) { line.append(&err[0], erriter - err.begin()); err.erase(err.begin(), err.end()); return cmsysProcess_Pipe_STDERR; - } else { - return cmsysProcess_Pipe_None; } + return cmsysProcess_Pipe_None; } } } @@ -2217,13 +2218,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file, // The new rpath is empty and there is no rpath anyway so it is // okay. return true; - } else { - if (emsg) { - *emsg = "No valid ELF RPATH or RUNPATH entry exists in the file; "; - *emsg += elf.GetErrorMessage(); - } - return false; } + if (emsg) { + *emsg = "No valid ELF RPATH or RUNPATH entry exists in the file; "; + *emsg += elf.GetErrorMessage(); + } + return false; } for (int i = 0; i < se_count; ++i) { @@ -2381,7 +2381,8 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, if (lhs < rhs) { // lhs < rhs, so true if operation is LESS return (op & cmSystemTools::OP_LESS) != 0; - } else if (lhs > rhs) { + } + if (lhs > rhs) { // lhs > rhs, so true if operation is GREATER return (op & cmSystemTools::OP_GREATER) != 0; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index d0a28e1..3c1a9f4 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -12,10 +12,13 @@ #ifndef cmSystemTools_h #define cmSystemTools_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include <cmsys/Process.h> #include <cmsys/SystemTools.hxx> +#include <stddef.h> +#include <string> +#include <vector> class cmSystemToolsFileTime; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8476538..ed04d2f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -12,21 +12,25 @@ #include "cmTarget.h" #include "cmAlgorithms.h" -#include "cmComputeLinkInformation.h" #include "cmGeneratorExpression.h" -#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmSourceFile.h" +#include "cmSourceFileLocation.h" +#include "cmSystemTools.h" #include "cmake.h" + +#include <algorithm> #include <assert.h> #include <cmsys/RegularExpression.hxx> -#include <errno.h> #include <map> #include <set> -#include <stdlib.h> // required for atof +#include <sstream> +#include <string.h> #if defined(CMake_HAVE_CXX_UNORDERED_SET) #include <unordered_set> @@ -770,12 +774,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) << prop << "\" is not allowed."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; - } else if (prop == "NAME") { + } + if (prop == "NAME") { std::ostringstream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; - } else if (prop == "INCLUDE_DIRECTORIES") { + } + if (prop == "INCLUDE_DIRECTORIES") { this->Internal->IncludeDirectoriesEntries.clear(); this->Internal->IncludeDirectoriesBacktraces.clear(); if (value) { @@ -852,12 +858,14 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, << prop << "\" is not allowed."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; - } else if (prop == "NAME") { + } + if (prop == "NAME") { std::ostringstream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; - } else if (prop == "INCLUDE_DIRECTORIES") { + } + if (prop == "INCLUDE_DIRECTORIES") { if (value && *value) { this->Internal->IncludeDirectoriesEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); @@ -1226,9 +1234,10 @@ const char* cmTarget::GetProperty(const std::string& prop, return output.c_str(); } // the type property returns what type the target is - else if (prop == propTYPE) { + if (prop == propTYPE) { return cmState::GetTargetTypeName(this->GetType()); - } else if (prop == propINCLUDE_DIRECTORIES) { + } + if (prop == propINCLUDE_DIRECTORIES) { if (this->Internal->IncludeDirectoriesEntries.empty()) { return CM_NULLPTR; } @@ -1236,7 +1245,8 @@ const char* cmTarget::GetProperty(const std::string& prop, static std::string output; output = cmJoin(this->Internal->IncludeDirectoriesEntries, ";"); return output.c_str(); - } else if (prop == propCOMPILE_FEATURES) { + } + if (prop == propCOMPILE_FEATURES) { if (this->Internal->CompileFeaturesEntries.empty()) { return CM_NULLPTR; } @@ -1244,7 +1254,8 @@ const char* cmTarget::GetProperty(const std::string& prop, static std::string output; output = cmJoin(this->Internal->CompileFeaturesEntries, ";"); return output.c_str(); - } else if (prop == propCOMPILE_OPTIONS) { + } + if (prop == propCOMPILE_OPTIONS) { if (this->Internal->CompileOptionsEntries.empty()) { return CM_NULLPTR; } @@ -1252,7 +1263,8 @@ const char* cmTarget::GetProperty(const std::string& prop, static std::string output; output = cmJoin(this->Internal->CompileOptionsEntries, ";"); return output.c_str(); - } else if (prop == propCOMPILE_DEFINITIONS) { + } + if (prop == propCOMPILE_DEFINITIONS) { if (this->Internal->CompileDefinitionsEntries.empty()) { return CM_NULLPTR; } @@ -1260,15 +1272,20 @@ const char* cmTarget::GetProperty(const std::string& prop, static std::string output; output = cmJoin(this->Internal->CompileDefinitionsEntries, ";"); return output.c_str(); - } else if (prop == propIMPORTED) { + } + if (prop == propIMPORTED) { return this->IsImported() ? "TRUE" : "FALSE"; - } else if (prop == propNAME) { + } + if (prop == propNAME) { return this->GetName().c_str(); - } else if (prop == propBINARY_DIR) { + } + if (prop == propBINARY_DIR) { return this->GetMakefile()->GetCurrentBinaryDirectory(); - } else if (prop == propSOURCE_DIR) { + } + if (prop == propSOURCE_DIR) { return this->GetMakefile()->GetCurrentSourceDirectory(); - } else if (prop == propSOURCES) { + } + if (prop == propSOURCES) { if (this->Internal->SourceEntries.empty()) { return CM_NULLPTR; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 209a729..fc30166 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -12,14 +12,23 @@ #ifndef cmTarget_h #define cmTarget_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep +#include "cmAlgorithms.h" #include "cmCustomCommand.h" #include "cmListFileCache.h" #include "cmPolicies.h" #include "cmPropertyMap.h" +#include "cmState.h" +#include "cmTargetLinkLibraryType.h" + +#include <iosfwd> +#include <map> +#include <set> +#include <string> +#include <utility> +#include <vector> -#include <cm_auto_ptr.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX_UNORDERED_MAP #include <unordered_map> @@ -28,16 +37,10 @@ #endif #endif -class cmake; class cmMakefile; class cmSourceFile; -class cmGlobalGenerator; -class cmListFileBacktrace; -class cmTarget; -class cmGeneratorTarget; -class cmTargetTraceDependencies; - class cmTargetInternals; + class cmTargetInternalPointer { public: diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 0658e95..790a3f8 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -11,10 +11,10 @@ ============================================================================*/ #include "cmTest.h" -#include "cmSystemTools.h" - #include "cmMakefile.h" -#include "cmake.h" +#include "cmProperty.h" +#include "cmState.h" +#include "cmSystemTools.h" cmTest::cmTest(cmMakefile* mf) : Backtrace(mf->GetBacktrace()) diff --git a/Source/cmTest.h b/Source/cmTest.h index db68008..ce3867c 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -12,11 +12,14 @@ #ifndef cmTest_h #define cmTest_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep -#include "cmCustomCommand.h" #include "cmListFileCache.h" #include "cmPropertyMap.h" + +#include <string> +#include <vector> + class cmMakefile; /** \class cmTest diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 462edf9..cfc174e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -12,11 +12,19 @@ #include "cmTestGenerator.h" #include "cmGeneratorExpression.h" +#include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" +#include "cmPropertyMap.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmTest.h" +#include <map> +#include <ostream> +#include <utility> + cmTestGenerator::cmTestGenerator( cmTest* test, std::vector<std::string> const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 66d590e..44574e7 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -12,10 +12,16 @@ #ifndef cmTestGenerator_h #define cmTestGenerator_h +#include <cmConfigure.h> // IWYU pragma: keep + #include "cmScriptGenerator.h" -class cmTest; +#include <iosfwd> +#include <string> +#include <vector> + class cmLocalGenerator; +class cmTest; /** \class cmTestGenerator * \brief Support class for generating install scripts. diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx index 6d09bdf..b072964 100644 --- a/Source/cmUuid.cxx +++ b/Source/cmUuid.cxx @@ -11,10 +11,10 @@ ============================================================================*/ #include "cmUuid.h" -#include <string.h> - #include "cm_sha2.h" + #include <cmsys/MD5.h> +#include <string.h> cmUuid::cmUuid() { @@ -180,13 +180,14 @@ bool cmUuid::IntFromHexDigit(char input, char& output) const if (input >= '0' && input <= '9') { output = char(input - '0'); return true; - } else if (input >= 'a' && input <= 'f') { + } + if (input >= 'a' && input <= 'f') { output = char(input - 'a' + 0xA); return true; - } else if (input >= 'A' && input <= 'F') { + } + if (input >= 'A' && input <= 'F') { output = char(input - 'A' + 0xA); return true; - } else { - return false; } + return false; } diff --git a/Source/cmUuid.h b/Source/cmUuid.h index 2bd7ec5..f01230c 100644 --- a/Source/cmUuid.h +++ b/Source/cmUuid.h @@ -12,7 +12,10 @@ #ifndef cmUuid_h #define cmUuid_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> +#include <vector> /** \class cmUuid * \brief Utility class to generate UUIDs as defined by RFC4122 diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 56e2770..ce700db 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -13,7 +13,9 @@ #include "cmAlgorithms.h" +#include <algorithm> #include <cm_auto_ptr.hxx> +#include <utility> static const char* const cmVariableWatchAccessStrings[] = { "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS", diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 5ddb907..88b3d1c 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -12,7 +12,11 @@ #ifndef cmVariableWatch_h #define cmVariableWatch_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> +#include <vector> class cmMakefile; diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx index 4c2e4ce..88cae0b 100644 --- a/Source/cmVersion.cxx +++ b/Source/cmVersion.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmVersion.h" -#include "cmVersionMacros.h" +#include "cmVersionConfig.h" unsigned int cmVersion::GetMajorVersion() { diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 46fd5a6..20e4c8c 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -12,7 +12,7 @@ #ifndef cmVersion_h #define cmVersion_h -#include "cmStandardIncludes.h" +#include <cm_kwiml.h> /** \class cmVersion * \brief Helper class for providing CMake and CTest version information. diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 5e06d36..7c53a3d 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -11,10 +11,12 @@ ============================================================================*/ #include "cmXMLParser.h" -#include <cmsys/FStream.hxx> - #include <cm_expat.h> +#include <cmsys/FStream.hxx> #include <ctype.h> +#include <iostream> +#include <sstream> +#include <string.h> cmXMLParser::cmXMLParser() { @@ -198,7 +200,7 @@ void cmXMLParser::ReportXmlParseError() XML_ErrorString(XML_GetErrorCode(parser))); } -void cmXMLParser::ReportError(int line, int, const char* msg) +void cmXMLParser::ReportError(int line, int /*unused*/, const char* msg) { if (this->ReportCallback) { this->ReportCallback(line, msg, this->ReportCallbackData); diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index 6aae81d..319b295 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -12,7 +12,9 @@ #ifndef cmXMLParser_h #define cmXMLParser_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> extern "C" { void cmXMLParserStartElement(void*, const char*, const char**); diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx index f899f57..8575181 100644 --- a/Source/cmXMLSafe.cxx +++ b/Source/cmXMLSafe.cxx @@ -13,9 +13,7 @@ #include "cm_utf8.h" -#include <iostream> #include <sstream> - #include <stdio.h> #include <string.h> diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h index 11ced13..a187437 100644 --- a/Source/cmXMLSafe.h +++ b/Source/cmXMLSafe.h @@ -12,7 +12,7 @@ #ifndef cmXMLSafe_h #define cmXMLSafe_h -#include <cmsys/Configure.hxx> +#include <cmConfigure.h> // IWYU pragma: keep #include <iosfwd> #include <string> diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index e2dce93d..eda5bef 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmXMLWriter.h" -#include "cmXMLSafe.h" - #include <cassert> #include <cmsys/FStream.hxx> diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 8a88dd4..c303963 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -12,7 +12,7 @@ #ifndef cmXMLWiter_h #define cmXMLWiter_h -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep #include "cmXMLSafe.h" diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b11f4f6..74c3f71 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -23,11 +23,15 @@ #include "cmState.h" #include "cmTest.h" #include "cmUtils.hxx" +#include "cmVersionMacros.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmGraphVizWriter.h" #include "cmVariableWatch.h" #include <cmsys/SystemInformation.hxx> + +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" #endif #include <cmsys/FStream.hxx> @@ -110,11 +114,24 @@ #include <list> +namespace { + +#if defined(CMAKE_BUILD_WITH_CMAKE) +#ifdef CMake_HAVE_CXX_UNORDERED_MAP +typedef std::unordered_map<std::string, Json::Value> JsonValueMapType; +#else +typedef cmsys::hash_map<std::string, Json::Value> JsonValueMapType; +#endif +#endif + +} // namespace + static bool cmakeCheckStampFile(const char* stampName); static bool cmakeCheckStampList(const char* stampName); -void cmWarnUnusedCliWarning(const std::string& variable, int, void* ctx, - const char*, const cmMakefile*) +void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, + void* ctx, const char* /*unused*/, + const cmMakefile* /*unused*/) { cmake* cm = reinterpret_cast<cmake*>(ctx); cm->MarkCliAsUsed(variable); @@ -201,6 +218,68 @@ cmake::~cmake() delete this->FileComparison; } +std::string cmake::ReportCapabilities() const +{ + std::string result; +#if defined(CMAKE_BUILD_WITH_CMAKE) + Json::Value obj = Json::objectValue; + // Version information: + Json::Value version = Json::objectValue; + version["string"] = CMake_VERSION; + version["major"] = CMake_VERSION_MAJOR; + version["minor"] = CMake_VERSION_MINOR; + version["suffix"] = CMake_VERSION_SUFFIX; + version["isDirty"] = (CMake_VERSION_IS_DIRTY == 1); + version["patch"] = CMake_VERSION_PATCH; + + obj["version"] = version; + + // Generators: + std::vector<cmake::GeneratorInfo> generatorInfoList; + this->GetRegisteredGenerators(generatorInfoList); + + JsonValueMapType generatorMap; + for (std::vector<cmake::GeneratorInfo>::const_iterator i = + generatorInfoList.begin(); + i != generatorInfoList.end(); ++i) { + if (i->isAlias) { // skip aliases, they are there for compatibility reasons + // only + continue; + } + + if (i->extraName.empty()) { + Json::Value gen = Json::objectValue; + gen["name"] = i->name; + gen["toolsetSupport"] = i->supportsToolset; + gen["platformSupport"] = i->supportsPlatform; + gen["extraGenerators"] = Json::arrayValue; + generatorMap[i->name] = gen; + } else { + Json::Value& gen = generatorMap[i->baseName]; + gen["extraGenerators"].append(i->extraName); + } + } + + Json::Value generators = Json::arrayValue; + for (JsonValueMapType::const_iterator i = generatorMap.begin(); + i != generatorMap.end(); ++i) { + generators.append(i->second); + } + obj["generators"] = generators; + +#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE + obj["serverMode"] = true; +#else + obj["serverMode"] = false; +#endif + Json::FastWriter writer; + result = writer.write(obj); +#else + result = "Not supported"; +#endif + return result; +} + void cmake::CleanupCommandsAndMacros() { this->CurrentSnapshot = this->State->Reset(); @@ -811,7 +890,8 @@ void cmake::AddDefaultExtraGenerators() #endif } -void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) +void cmake::GetRegisteredGenerators( + std::vector<GeneratorInfo>& generators) const { for (RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(), e = this->Generators.end(); @@ -1433,9 +1513,8 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) if (this->GetWorkingMode() != NORMAL_MODE) { if (cmSystemTools::GetErrorOccuredFlag()) { return -1; - } else { - return 0; } + return 0; } // If MAKEFLAGS are given in the environment, remove the environment @@ -1983,11 +2062,10 @@ cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf, if (i != this->InstalledFiles.end()) { cmInstalledFile& file = i->second; return &file; - } else { - cmInstalledFile& file = this->InstalledFiles[name]; - file.SetName(mf, name); - return &file; } + cmInstalledFile& file = this->InstalledFiles[name]; + file.SetName(mf, name); + return &file; } cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const @@ -1998,9 +2076,8 @@ cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const if (i != this->InstalledFiles.end()) { cmInstalledFile const& file = i->second; return &file; - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } int cmake::GetSystemInformation(std::vector<std::string>& args) @@ -2173,11 +2250,10 @@ static bool cmakeCheckStampFile(const char* stampName) std::cout << "CMake does not need to re-run because " << stampName << " is up-to-date.\n"; return true; - } else { - cmSystemTools::RemoveFile(stampTemp); - cmSystemTools::Error("Cannot restore timestamp ", stampName); - return false; } + cmSystemTools::RemoveFile(stampTemp); + cmSystemTools::Error("Cannot restore timestamp ", stampName); + return false; } static bool cmakeCheckStampList(const char* stampList) diff --git a/Source/cmake.h b/Source/cmake.h index 304a15d..343d371 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -117,6 +117,8 @@ public: /// Destructor ~cmake(); + std::string ReportCapabilities() const; + static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } static const char* GetCMakeFilesDirectoryPostSlash() { @@ -187,7 +189,7 @@ public: void SetGlobalGenerator(cmGlobalGenerator*); ///! Get the names of the current registered generators - void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators); + void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) const; ///! Set the name of the selected generator-specific platform. void SetGeneratorPlatform(std::string const& ts) diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 521a5bf..1505d00 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -124,8 +124,8 @@ static std::string cmakemainGetStack(void* clientdata) return msg; } -static void cmakemainMessageCallback(const char* m, const char*, bool&, - void* clientdata) +static void cmakemainMessageCallback(const char* m, const char* /*unused*/, + bool& /*unused*/, void* clientdata) { std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush; } @@ -163,7 +163,8 @@ int main(int ac, char const* const* av) if (ac > 1) { if (strcmp(av[1], "--build") == 0) { return do_build(ac, av); - } else if (strcmp(av[1], "-E") == 0) { + } + if (strcmp(av[1], "-E") == 0) { return do_command(ac, av); } } @@ -237,7 +238,8 @@ int do_cmake(int ac, char const* const* av) "Use cmake-gui or ccmake for an interactive dialog.\n"; /* clang-format on */ return 1; - } else if (strcmp(av[i], "--system-information") == 0) { + } + if (strcmp(av[i], "--system-information") == 0) { sysinfo = true; } else if (strcmp(av[i], "-N") == 0) { view_only = true; @@ -313,9 +315,8 @@ int do_cmake(int ac, char const* const* av) // interpret negative return values as errors. if (res != 0) { return 1; - } else { - return 0; } + return 0; } static int do_build(int ac, char const* const* av) diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 44f71f1..167d60a 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -21,6 +21,7 @@ #include <cmSystemTools.h> #include <cmsys/Encoding.hxx> +#include <algorithm> #include <sstream> #include <windows.h> diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9d0337a..f25c085 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -60,6 +60,8 @@ void CMakeCommandUsage(const char* program) errorStream << "Usage: " << program << " -E <command> [arguments...]\n" << "Available commands: \n" + << " capabilities - Report capabilities built into cmake " + "in JSON format\n" << " chdir dir cmd [args...] - run command in a given directory\n" << " compare_files file1 file2 - check if file1 is same as file2\n" << " copy <file>... destination - copy files to destination " @@ -260,7 +262,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // 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. - else if (args[1] == "__run_iwyu") { + if (args[1] == "__run_iwyu") { if (args.size() < 3) { std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]" " [--tidy=/path/tidy] -- compile command\n"; @@ -391,13 +393,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } // Echo string - else if (args[1] == "echo") { + if (args[1] == "echo") { std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl; return 0; } // Echo string no new line - else if (args[1] == "echo_append") { + if (args[1] == "echo_append") { std::cout << cmJoin(cmMakeRange(args).advance(2), " "); return 0; } @@ -510,6 +512,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } return 0; } + // capabilities + else if (args[1] == "capabilities") { + if (args.size() > 2) { + std::cerr << "-E capabilities accepts no additional arguments\n"; + return 1; + } + cmake cm; + std::cout << cm.ReportCapabilities(); + return 0; + } // Sleep command else if (args[1] == "sleep" && args.size() > 2) { @@ -839,7 +851,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) cmSystemTools::Error("Can not use compression flags with format: ", format.c_str()); return 1; - } else if (nCompress > 1) { + } + if (nCompress > 1) { cmSystemTools::Error("Can only compress a tar file one way; " "at most one flag of z, j, or J may be used"); return 1; @@ -983,12 +996,12 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num) int count = 0; if (!progFile) { return; - } else { - if (1 != fscanf(progFile, "%i", &count)) { - cmSystemTools::Message("Could not read from progress file."); - } - fclose(progFile); } + if (1 != fscanf(progFile, "%i", &count)) { + cmSystemTools::Message("Could not read from progress file."); + } + fclose(progFile); + const char* last = num.c_str(); for (const char* c = last;; ++c) { if (*c == ',' || *c == '\0') { diff --git a/Source/dir.dox b/Source/dir.dox new file mode 100644 index 0000000..66e3de7 --- /dev/null +++ b/Source/dir.dox @@ -0,0 +1,7 @@ +/*! + +\dir + +\brief Root \c ${CMake_SOURCE_DIR}/Source directory + +*/ diff --git a/Source/dir.dox.in b/Source/dir.dox.in new file mode 100644 index 0000000..78cf58d --- /dev/null +++ b/Source/dir.dox.in @@ -0,0 +1,7 @@ +/*! + +\dir + +\brief Generated \c ${CMake_BINARY_DIR}/Source directory + +*/ diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index b811c7f..502ffe7 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -1,5 +1,13 @@ #include "cmSystemTools.h" +#include <fstream> +#include <iostream> +#include <map> +#include <stdlib.h> +#include <string> +#include <utility> +#include <vector> + class CompileCommandParser { public: diff --git a/Tests/CMakeLib/testGeneratedFileStream.cxx b/Tests/CMakeLib/testGeneratedFileStream.cxx index 67dd69a..e5a2f4d 100644 --- a/Tests/CMakeLib/testGeneratedFileStream.cxx +++ b/Tests/CMakeLib/testGeneratedFileStream.cxx @@ -16,7 +16,7 @@ std::cout << "FAILED: " << m1 << m2 << "\n"; \ failed = 1 -int testGeneratedFileStream(int, char* []) +int testGeneratedFileStream(int /*unused*/, char* /*unused*/ []) { int failed = 0; cmGeneratedFileStream gm; diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index a3846c0..8e8d4c4 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -11,12 +11,15 @@ ============================================================================*/ #include "cmSystemTools.h" +#include <iostream> +#include <string> + #define cmPassed(m) std::cout << "Passed: " << m << "\n" #define cmFailed(m) \ std::cout << "FAILED: " << m << "\n"; \ failed = 1 -int testSystemTools(int, char* []) +int testSystemTools(int /*unused*/, char* /*unused*/ []) { int failed = 0; // ---------------------------------------------------------------------- diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index 1da23fe..019a2dd 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -97,7 +97,7 @@ static bool decode_bad(test_utf8_char const s) return true; } -int testUTF8(int, char* []) +int testUTF8(int /*unused*/, char* /*unused*/ []) { int result = 0; for (test_utf8_entry const* e = good_entry; e->n; ++e) { diff --git a/Tests/CMakeLib/testXMLParser.cxx b/Tests/CMakeLib/testXMLParser.cxx index 1fd5113..d5e9764 100644 --- a/Tests/CMakeLib/testXMLParser.cxx +++ b/Tests/CMakeLib/testXMLParser.cxx @@ -4,7 +4,7 @@ #include <iostream> -int testXMLParser(int, char* []) +int testXMLParser(int /*unused*/, char* /*unused*/ []) { // TODO: Derive from parser and check attributes. cmXMLParser parser; diff --git a/Tests/CMakeLib/testXMLSafe.cxx b/Tests/CMakeLib/testXMLSafe.cxx index 34c38fb..4970ccc 100644 --- a/Tests/CMakeLib/testXMLSafe.cxx +++ b/Tests/CMakeLib/testXMLSafe.cxx @@ -28,7 +28,7 @@ static test_pair const pairs[] = { { 0, 0 } }; -int testXMLSafe(int, char* []) +int testXMLSafe(int /*unused*/, char* /*unused*/ []) { int result = 0; for (test_pair const* p = pairs; p->in; ++p) { diff --git a/Tests/RunCMake/CommandLine/E_capabilities-arg-result.txt b/Tests/RunCMake/CommandLine/E_capabilities-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_capabilities-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_capabilities-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_capabilities-arg-stderr.txt new file mode 100644 index 0000000..f74cebe --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_capabilities-arg-stderr.txt @@ -0,0 +1 @@ +^-E capabilities accepts no additional arguments$ diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt new file mode 100644 index 0000000..6c5ea44 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -0,0 +1 @@ +^{.*}$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 077a19d..6ae47a8 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -8,6 +8,8 @@ run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) +run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) +run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index 813e34d..6ebf2b4 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -10,30 +10,96 @@ # See the License for more information. #============================================================================= +if(NOT CMake_SOURCE_DIR) + set(CMakeDeveloperReference_STANDALONE 1) + cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR) + get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) + get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) + include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) + include(${CMake_SOURCE_DIR}/Source/CMakeVersionCompute.cmake) + include(${CMake_SOURCE_DIR}/Source/CMakeInstallDestinations.cmake) + unset(CMAKE_DATA_DIR) + unset(CMAKE_DATA_DIR CACHE) + macro(CMake_OPTIONAL_COMPONENT) + set(COMPONENT "") + endmacro() +endif() + +project(CMakeDeveloperReference NONE) + # -# Build the documentation +# Build the reference # -include (${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) -if (BUILD_DOCUMENTATION) +if (CMake_BUILD_DEVELOPER_REFERENCE OR CMakeDeveloperReference_STANDALONE) + + find_package(Doxygen REQUIRED) + + # + ## Output formats + # + + option(CMake_BUILD_DEVELOPER_REFERENCE_HTML "Build CMake Developer Reference - HTML format" ON) + mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE_HTML) + if(CMake_BUILD_DEVELOPER_REFERENCE_HTML) + set(GENERATE_HTML YES) + else() + set(GENERATE_HTML NO) + endif() + + option(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP "Build CMake Developer Reference - QtHelp format" OFF) + mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP) + if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP) + set(GENERATE_QHP YES) + find_program(QHELPGENERATOR_EXECUTABLE + NAMES qhelpgenerator + DOC "qhelpgenerator tool" + ) + if(NOT QHELPGENERATOR_EXECUTABLE) + message(FATAL_ERROR "QHELPGENERATOR_EXECUTABLE (qhelpgenerator) not found!") + endif() + else() + set(GENERATE_QHP NO) + endif() # # Configure the script and the doxyfile, then add target # + + if(DOXYGEN_DOT_FOUND) + set(HAVE_DOT YES) + else() + set(HAVE_DOT NO) + endif() + if(NOT DOT_PATH) - get_filename_component(DOT_PATH ${DOT} PATH) + get_filename_component(DOT_PATH ${DOXYGEN_DOT_EXECUTABLE} PATH) endif() - configure_file( - ${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in - ${CMake_BINARY_DIR}/Utilities/Doxygen/doxyfile) + configure_file(doxyfile.in doxyfile @ONLY) + + add_custom_target(cmake-developer-reference-all + ${DOXYGEN_EXECUTABLE} doxyfile + WORKING_DIRECTORY ${CMakeDeveloperReference_BINARY_DIR}) + + add_custom_target(cmake-developer-reference ALL DEPENDS cmake-developer-reference-all) - configure_file( - ${CMake_SOURCE_DIR}/Utilities/Doxygen/doc_makeall.sh.in - ${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh) + # + # Installation + # - add_custom_target(DoxygenDoc - ${BASH} - ${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh) + if(CMake_BUILD_DEVELOPER_REFERENCE_HTML) + CMake_OPTIONAL_COMPONENT(cmake-developer-reference-html) + install(DIRECTORY "${CMakeDeveloperReference_BINARY_DIR}/developer-reference/html" + DESTINATION ${CMAKE_DOC_DIR}/developer-reference + ${COMPONENT}) + endif() + + if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP) + CMake_OPTIONAL_COMPONENT(cmake-developer-reference-qthelp) + install(FILES "${CMakeDeveloperReference_BINARY_DIR}/developer-reference/CMakeDeveloperReference-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch" + DESTINATION ${CMAKE_DOC_DIR}/developer-reference + ${COMPONENT}) + endif() endif () diff --git a/Utilities/Doxygen/DeveloperReference/mainpage.dox b/Utilities/Doxygen/DeveloperReference/mainpage.dox new file mode 100644 index 0000000..a37927f --- /dev/null +++ b/Utilities/Doxygen/DeveloperReference/mainpage.dox @@ -0,0 +1,8 @@ +/*! + +\mainpage CMake Developer Reference + +This manual is intended for reference by developers modifying the CMake +source tree itself. + +*/ diff --git a/Utilities/Doxygen/authors.txt b/Utilities/Doxygen/authors.txt deleted file mode 100644 index 9ba6cca..0000000 --- a/Utilities/Doxygen/authors.txt +++ /dev/null @@ -1,17 +0,0 @@ -andy: Cedilnik, Andy (andy.cedilnik@kitware.com) -barre: Barre, Sebastien (sebastien.barre@kitware.com) -berk: Geveci, Berk (berk.geveci@kitware.com) -bettingf: Bettinger, Franck (bettingf@cs.man.ac.uk) -biddi: Biddiscombe, John (jbiddiscombe@skippingmouse.co.uk) -blezek: Blezek, Dan (blezek@crd.ge.com) -geoff: Cross, Geoffrey (geoff@robots.ox.ac.uk) -hoffman: Hoffman, Bill (bill.hoffman@kitware.com) -ibanez: Ibanez, Luis (luis.ibanez@kitware.com) -iscott: Scott, Ian (ian.m.scott@stud.man.ac.uk) -king: King, Brad (brad.king@kitware.com) -lorensen: Lorensen, Bill (lorensen@crd.ge.com) -martink, lymbdemo: Martin, Ken (ken.martin@kitware.com) -millerjv: Miller, Jim (millerjv@crd.ge.com) -perera: Perera, Amitha (perera@cs.rpi.edu) -starreveld: Starreveld, Yves (ystarrev@julian.uwo.ca) -will, schroede: Schroeder, Will (will.schroeder@kitware.com) diff --git a/Utilities/Doxygen/doc_makeall.sh.in b/Utilities/Doxygen/doc_makeall.sh.in deleted file mode 100755 index fceafdd..0000000 --- a/Utilities/Doxygen/doc_makeall.sh.in +++ /dev/null @@ -1,248 +0,0 @@ -# ------------------------------------------------------------------------- -# Doxygen documentation batch -# modified by S. Barre (Time-stamp: <2003-01-16 14:04:41 barre> -# ------------------------------------------------------------------------- - -# Path to several tools (_PROG to avoid the typical GZIP env var pb) -# Example: -# DOXYGEN_PROG=@DOXYGEN@ (INCLUDE(${CMAKE_ROOT}/Modules/FindDoxygen.cmake)) -# GZIP_PROG=@GZIP@ (INCLUDE(${CMAKE_ROOT}/Modules/FindCygwin.cmake)) -# HHC_PROG=@HHC@ (INCLUDE(${CMAKE_ROOT}/Modules/FindHhc.cmake)) -# MV_PROG=@MV@ (INCLUDE(${CMAKE_ROOT}/Modules/FindCygwin.cmake)) -# PERL_PROG=@PERL@ (INCLUDE(${CMAKE_ROOT}/Modules/FindPerl.cmake)) -# RM_PROG=@RM@ (INCLUDE(${CMAKE_ROOT}/Modules/FindCygwin.cmake)) -# TAR_PROG=@TAR@ (INCLUDE(${CMAKE_ROOT}/Modules/FindCygwin.cmake)) -# WGET_PROG=@WGET@ (INCLUDE(${CMAKE_ROOT}/Modules/FindWget.cmake)) -# -export DOXYGEN_PROG="@DOXYGEN@" # Doxygen -export GZIP_PROG="@GZIP@" # gzip (Unix-like 'gzip compressor') -export GNUPLOT_PROG="@GNUPLOT@" # gnuplot (data plotting program) -export HHC_PROG="@HTML_HELP_COMPILER@" # HTML Help Compiler -export MV_PROG="@MV@" # mv (Unix-like 'move/rename files') -export PERL_PROG="@PERL@" # Perl -export RM_PROG="@RM@" # rm (Unix-like 'remove files') -export TAR_PROG="@TAR@" # tar (Unix-like 'archiver') -export WGET_PROG="@WGET@" # wget (remote file retrieval) - -# PROJECT_NAME: -# Documentation/project name. Used in some of the resulting file names and -# xrefs to uniquify two or more projects linked together through their -# Doxygen's tag files. Mandatory for each documentation set. -# Note: might be the same as the doxyfile's PROJECT_NAME -# Example: -# PROJECT_NAME=VTK -# -export PROJECT_NAME=CMake - -# PATH_TO_VTK_DOX_SCRIPTS: -# Path to the directory holding the Perl scripts used to produce the VTK doc -# in Doxygen format. You need the VTK source files or a local copy of -# these scripts. -# Example: -# PATH_TO_VTK_DOX_SCRIPTS=@VTK_SOURCE_DIR@/Utilities/Doxygen -# -export PATH_TO_VTK_DOX_SCRIPTS="@VTK_SOURCE_DIR@/Utilities/Doxygen" - -# SOURCE_DIR: -# Source directory. The top directory of the source files. -# Example: -# SOURCE_DIR=@VTK_SOURCE_DIR@ -# -export SOURCE_DIR="@CMake_SOURCE_DIR@" - -# REL_PATH_TO_TOP: -# Relative path from the top directory of the source files to the directory -# (or top directory) holding the files to document. Useful if several parts -# of the same source directory should be documented separately. -# Example: -# REL_PATH_TO_TOP=. -# REL_PATH_TO_TOP=framework/src -# -# export REL_PATH_TO_TOP=Source -export REL_PATH_TO_TOP=. - -# INTERMEDIATE_DOX_DIR: -# Directory where the intermediate Doxygen files should be stored (mainly -# these headers files converted from the VTK format to the Doxygen format). -# This directory is erased at the end of this script, unless you comment -# the corresponding line. -# DOXTEMP might be used to simplify the syntax. -# Example: -# DOXTEMP=DOXTEMP=@VTK_BINARY_DIR@/Utilities/Doxygen -# INTERMEDIATE_DOX_DIR=$DOXTEMP/dox -# -export DOXTEMP="@CMake_BINARY_DIR@/Utilities/Doxygen" -export INTERMEDIATE_DOX_DIR="$DOXTEMP/dox" - -# DOXYFILE: -# Path to the Doxygen configuration file (i.e. doxyfile). -# Example: -# DOXYFILE=$DOXTEMP/doxyfile -# -export DOXYFILE="$DOXTEMP/doxyfile" - -# OUTPUT_DIRECTORY ALLOW_ERASE_OUTPUT_DIRECTORY: -# Path to the Doxygen output directory (where the resulting doc is stored). -# Note: should be the same as your doxyfile's OUTPUT_DIRECTORY -# If ON, allows the output directory to be erased when some advanced output -# file have been produced (HTML Help, or TAR archive for example). -# Example: -# OUTPUT_DIRECTORY=$DOXTEMP/doc -# ALLOW_ERASE_OUTPUT_DIRECTORY=ON -# -export OUTPUT_DIRECTORY="$DOXTEMP/doc" -export ALLOW_ERASE_OUTPUT_DIRECTORY=ON - -# COMPILE_HTML_HELP RESULTING_HTML_HELP_FILE: -# Compile the CHM (Compressed HTML) HTML Help file, name of the resulting -# file. If set to ON and name is non-empty these options will actually -# trigger the HTML-Help compiler to create the CHM. The resulting -# file (usually index.chm) will be renamed to this name. -# Note: if ON, the whole $OUTPUT_DIRECTORY will be erased at the end of -# this script, since this file is considered to be one of the -# advanced final output, unless ALLOW_ERASE_OUTPUT_DIRECTORY is OFF -# Note: your doxyfile should be configured to enable HTML Help creation -# (using GENERATE_HTML = YES, GENERATE_HTMLHELP = YES) -# Example: -# COMPILE_HTML_HELP=ON -# COMPILE_HTML_HELP=@DOCUMENTATION_HTML_HELP@ -# RESULTING_HTML_HELP_FILE=$DOXTEMP/vtk4.chm -# -export COMPILE_HTML_HELP=@DOCUMENTATION_HTML_HELP@ -export RESULTING_HTML_HELP_FILE="$DOXTEMP/$PROJECT_NAME.chm" - -# CREATE_HTML_TARZ_ARCHIVE RESULTING_HTML_TARZ_ARCHIVE_FILE: -# Create a compressed (gzip) tar archive of the html directory (located -# under the OUTPUT_DIRECTORY), and name of the resulting archive file. -# Note: your doxyfile should be configured to enable HTML creation -# (using GENERATE_HTML = YES) -# Example: -# CREATE_HTML_TARZ_ARCHIVE=ON -# CREATE_HTML_TARZ_ARCHIVE=@DOCUMENTATION_HTML_TARZ@ -# RESULTING_HTML_TARZ_ARCHIVE_FILE=$DOXTEMP/vtk4-html.tar.gz -# RESULTING_HTML_TARZ_ARCHIVE_FILE=$DOXTEMP/$PROJECT_NAME-html.tar.gz -# -export CREATE_HTML_TARZ_ARCHIVE=@DOCUMENTATION_HTML_TARZ@ -export RESULTING_HTML_TARZ_ARCHIVE_FILE="$DOXTEMP/$PROJECT_NAME-html.tar.gz" - -# ---------------------------------------------------------------------------- -# Build the contributors list. - -if test "x@VTK_SOURCE_DIR@" != "x" ; then - if test "x$PERL_PROG" != "xNOTFOUND" ; then - "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \ - --authors "$SOURCE_DIR/Utilities/Doxygen/authors.txt" \ - --cachedir "$DOXTEMP/cache" \ - --class_group '^(cm[A-Z0-9][A-Za-z0-9]+)\.(?:c|cpp|cxx|h|fl)$' \ - --files_in '(?:^hints|dummy|README|^Makefile\.borland|\.(?:c|cmake|cpp|cxx|h|html|in|java|fl|pl|py|tcl|txt))$' \ - --files_out '(?:^ChangeLog\.txt)$' \ - --gnuplot_file "$DOXTEMP/contrib/history.plt" \ - --history_img "|lines|$DOXTEMP/contrib/history.png" \ - --history_img "365|lines|$DOXTEMP/contrib/history2y.png" \ - --history_img "180|linespoints|$DOXTEMP/contrib/history6m.png" \ - --history_dir "$DOXTEMP/contrib" \ - --history_max_nb 10 \ - --lines_add 1.0 \ - --lines_rem 0.5 \ - --massive 50 \ - --max_class_nb 10 \ - --max_file_nb 5 \ - --min_class 0.02 \ - --min_file 0.01 \ - --min_contrib 0.05 \ - --min_gcontrib 0.0001 \ - --store "doc_""$PROJECT_NAME""_contributors.dox" \ - --relativeto "$SOURCE_DIR/$REL_PATH_TO_TOP" \ - --to "$INTERMEDIATE_DOX_DIR" \ - "$SOURCE_DIR/$REL_PATH_TO_TOP" - fi - - if test "x$GNUPLOT_PROG" != "xNOTFOUND" ; then - "$GNUPLOT_PROG" "$DOXTEMP/contrib/history.plt" - fi -fi - -# ---------------------------------------------------------------------------- -# Create the Doxygen doc. - -if test "x$DOXYGEN_PROG" != "xNOTFOUND" ; then - - if test "x$RM_PROG" != "xNOTFOUND" ; then - "$RM_PROG" -fr "$OUTPUT_DIRECTORY" - fi - - "$DOXYGEN_PROG" "$DOXYFILE" - - # yes, a second time, to get the contrib, I don't know why - "$DOXYGEN_PROG" "$DOXYFILE" -fi - -# ---------------------------------------------------------------------------- -# Clean the HTML pages to remove the path to the intermediate Doxygen dir. - -if test "x@VTK_SOURCE_DIR@" != "x" ; then - if test "x$PERL_PROG" != "xNOTFOUND" ; then - "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \ - --verbose \ - --to "$INTERMEDIATE_DOX_DIR" \ - --html "$OUTPUT_DIRECTORY/html" - fi -fi - -# ---------------------------------------------------------------------------- -# Create the CHM HTML HELP doc. - -if test "x$COMPILE_HTML_HELP" == "xON" ; then - if test "x$RESULTING_HTML_HELP_FILE" != "x" ; then - cd $OUTPUT_DIRECTORY/html - if test "x$HHC_PROG" != "xNOTFOUND" ; then - "$HHC_PROG" index.hhp - if test "x$MV_PROG" != "xNOTFOUND" ; then - "$MV_PROG" -f index.chm "$RESULTING_HTML_HELP_FILE" - fi - fi - fi -fi - -# ---------------------------------------------------------------------------- -# Create the compressed tar archive. - -if test "x$CREATE_HTML_TARZ_ARCHIVE" == "xON" ; then - if test "x$RESULTING_HTML_TARZ_ARCHIVE_FILE" != "x" ; then - cd "$OUTPUT_DIRECTORY" - if test "x$TAR_PROG" != "xNOTFOUND" ; then - if test "x$RM_PROG" != "xNOTFOUND" ; then - "$RM_PROG" -f html.tar - fi - "$TAR_PROG" -cf html.tar html - if test "x$GZIP_PROG" != "xNOTFOUND" ; then - if test "x$RM_PROG" != "xNOTFOUND" ; then - "$RM_PROG" -f html.tar.gz - fi - "$GZIP_PROG" html.tar - "$MV_PROG" -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE" - fi - fi - fi -fi - -# ---------------------------------------------------------------------------- -# Clean-up. - -if test "x$RM_PROG" != "xNOTFOUND" ; then - "$RM_PROG" -fr "$INTERMEDIATE_DOX_DIR" - - if test "x$DOWNLOAD_VTK_TAGFILE" == "xON" ; then - if test "x$VTK_TAGFILE" != "x" ; then - "$RM_PROG" -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE" - fi - fi - - if test "x$COMPILE_HTML_HELP" == "xON" ; then - if test "x$RESULTING_HTML_HELP_FILE" != "x" ; then - if test "x$ALLOW_ERASE_OUTPUT_DIRECTORY" == "xON" ; then - "$RM_PROG" -fr "$OUTPUT_DIRECTORY" - fi - fi - fi -fi diff --git a/Utilities/Doxygen/doxyfile.in b/Utilities/Doxygen/doxyfile.in index 2c131f5..7333340 100644 --- a/Utilities/Doxygen/doxyfile.in +++ b/Utilities/Doxygen/doxyfile.in @@ -1,28 +1,30 @@ # ------------------------------------------------------------------------- -# doxyfile for CMake -# modified by S. Barre (Time-stamp: <2002-02-13 18:24:35 barre> +# doxyfile for CMakeReference # ------------------------------------------------------------------------- PROJECT_NAME = CMake +PROJECT_BRIEF = "Cross-platform Make" +PROJECT_NUMBER = "@CMake_VERSION@" +PROJECT_LOGO = "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup64.png" FULL_PATH_NAMES = YES STRIP_FROM_PATH = \ - "@CMake_SOURCE_DIR@/Source/" \ - "@CMake_BINARY_DIR@/Source/" + "@CMake_SOURCE_DIR@/" \ + "@CMake_BINARY_DIR@/" WARN_IF_UNDOCUMENTED = NO GENERATE_TREEVIEW = NO GENERATE_TODOLIST = YES GENERATE_BUGLIST = YES -GENERATE_HTML = YES +GENERATE_HTML = @GENERATE_HTML@ GENERATE_HTMLHELP = YES +GENERATE_QHP = @GENERATE_QHP@ GENERATE_LATEX = NO GENERATE_MAN = NO GENERATE_RTF = NO -HAVE_DOT = YES -#HAVE_DOT = NO +HAVE_DOT = @HAVE_DOT@ DOT_PATH = "@DOT_PATH@" CLASS_GRAPH = YES COLLABORATION_GRAPH = YES @@ -37,20 +39,21 @@ REFERENCES_RELATION = YES ALLEXTERNALS = NO -IMAGE_PATH = "@CMake_BINARY_DIR@/Utilities/Doxygen/contrib" - -OUTPUT_DIRECTORY = "@CMake_BINARY_DIR@/Utilities/Doxygen/doc" +OUTPUT_DIRECTORY = "@CMakeDeveloperReference_BINARY_DIR@/developer-reference" INPUT = \ + "@CMake_SOURCE_DIR@/Utilities/Doxygen/DeveloperReference" \ "@CMake_SOURCE_DIR@/Source" \ "@CMake_SOURCE_DIR@/Source/CPack" \ "@CMake_SOURCE_DIR@/Source/CPack/IFW" \ + "@CMake_SOURCE_DIR@/Source/CPack/WiX" \ "@CMake_SOURCE_DIR@/Source/CTest" \ "@CMake_SOURCE_DIR@/Source/CursesDialog" \ - "@CMake_SOURCE_DIR@/Source/MFCDialog" \ + "@CMake_SOURCE_DIR@/Source/kwsys" \ + "@CMake_SOURCE_DIR@/Source/QtDialog" \ + "@CMake_BINARY_DIR@/Source" \ "@CMake_BINARY_DIR@/Source/kwsys" \ - "@CMake_BINARY_DIR@/Source/cmsys" \ - "@CMake_BINARY_DIR@/Utilities/Doxygen/dox/doc_CMake_contributors.dox" \ + "@CMake_BINARY_DIR@/Source/cmsys" EXTRACT_ALL = YES EXTRACT_PRIVATE = NO @@ -68,7 +71,7 @@ SORT_MEMBER_DOCS = NO DISTRIBUTE_GROUP_DOC = YES TAB_SIZE = 3 -FILE_PATTERNS = *.h *.hxx *.cxx +FILE_PATTERNS = *.h *.hxx *.cxx *.dox RECURSIVE = NO EXCLUDE_PATTERNS = @@ -82,3 +85,7 @@ MACRO_EXPANSION = YES SEARCH_INCLUDES = YES INCLUDE_PATH = EXPAND_ONLY_PREDEF = YES + +QHP_NAMESPACE = org.cmake.developer-reference.@CMake_VERSION_MAJOR@@CMake_VERSION_MINOR@@CMake_VERSION_PATCH@ +QCH_FILE = ../CMakeDeveloperReference-@CMake_VERSION_MAJOR@@CMake_VERSION_MINOR@@CMake_VERSION_PATCH@.qch +QHG_LOCATION = "@QHELPGENERATOR_EXECUTABLE@" diff --git a/Utilities/cmlibarchive/libarchive/xxhash.c b/Utilities/cmlibarchive/libarchive/xxhash.c index d7f8e96..262fecb 100644 --- a/Utilities/cmlibarchive/libarchive/xxhash.c +++ b/Utilities/cmlibarchive/libarchive/xxhash.c @@ -29,12 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - xxHash source repository : http://code.google.com/p/xxhash/ */ -#include <stdlib.h> -#include <string.h> #include "archive_platform.h" #include "archive_xxhash.h" +#include <stdlib.h> +#include <string.h> + #ifdef HAVE_LIBLZ4 /*************************************** |