From 12a145534ae04b99fdbd23aec53c9113718c9ad0 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Sat, 31 Mar 2018 19:28:03 +0100 Subject: gitignore: Ignore a .vs directory in the source tree --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5d1732d..22e9800 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ *.pyc Testing + +# Visual Studio work directory +.vs/ -- cgit v0.12 From 966dba5b683149e8c42d35a89cd60d593e542593 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Tue, 3 Apr 2018 16:28:44 -0400 Subject: cmAlgorithms: Remove unnecessary typename keyword --- Source/cmAlgorithms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 3380b78..244dc1c 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -311,7 +311,7 @@ struct RemoveDuplicatesAPI template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef typename ContainerAlgorithms::RemoveDuplicatesAPI API; + typedef ContainerAlgorithms::RemoveDuplicatesAPI API; typedef typename API::value_type T; std::vector unique; unique.reserve(r.size()); -- cgit v0.12 From b0676cc5d48a5e7b79e8c95545b464b67248d96e Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Tue, 3 Apr 2018 22:18:48 +0100 Subject: Add in-class initialization of some members Several class constructors leave members uninitialized. The members are initialized before use in methods, but it is clearer and less error-prone to initialize them at their definition site. --- Source/cmConfigureFileCommand.h | 6 +++--- Source/cmCoreTryCompile.h | 2 +- Source/cmExportLibraryDependenciesCommand.h | 2 +- Source/cmExternalMakefileProjectGenerator.h | 2 +- Source/cmInstallFilesCommand.h | 2 +- Source/cmTargetLinkLibrariesCommand.h | 4 ++-- Source/cmTargetPropCommandBase.h | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index cff934b..5603c50 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -32,9 +32,9 @@ private: std::string InputFile; std::string OutputFile; - bool CopyOnly; - bool EscapeQuotes; - bool AtOnly; + bool CopyOnly = false; + bool EscapeQuotes = false; + bool AtOnly = false; }; #endif diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 6f35a54..ae714a6 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -46,7 +46,7 @@ protected: std::string BinaryDirectory; std::string OutputFile; std::string FindErrorMessage; - bool SrcFileSignature; + bool SrcFileSignature = false; private: std::vector WarnCMP0067; diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index bf5e9bc..8414866 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -27,7 +27,7 @@ public: private: std::string Filename; - bool Append; + bool Append = false; void ConstFinalPass() const; }; diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 5cc6442..d48abca 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -62,7 +62,7 @@ protected: ///! Contains the names of the global generators support by this generator. std::vector SupportedGlobalGenerators; ///! the global generator which creates the makefiles - const cmGlobalGenerator* GlobalGenerator; + const cmGlobalGenerator* GlobalGenerator = nullptr; std::string Name; }; diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 19f2559..a52f45e 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -48,7 +48,7 @@ protected: private: std::vector FinalArgs; - bool IsFilesForm; + bool IsFilesForm = false; std::string Destination; std::vector Files; }; diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index a2f3ecd..54f8cf4 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -43,7 +43,7 @@ private: void LinkLibraryTypeSpecifierWarning(int left, int right); static const char* LinkLibraryTypeNames[3]; - cmTarget* Target; + cmTarget* Target = nullptr; enum ProcessingState { ProcessingLinkLibraries, @@ -55,7 +55,7 @@ private: ProcessingKeywordPrivateInterface }; - ProcessingState CurrentProcessingState; + ProcessingState CurrentProcessingState = ProcessingLinkLibraries; bool HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt); }; diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index 3c736fc..943285d 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -28,7 +28,7 @@ public: protected: std::string Property; - cmTarget* Target; + cmTarget* Target = nullptr; virtual void HandleInterfaceContent(cmTarget* tgt, const std::vector& content, -- cgit v0.12 From 2f87d008034d92a54beb586c031c636596055034 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Tue, 3 Apr 2018 17:30:46 -0400 Subject: cmMacroCommand: Fix format string to match type of argument --- Source/cmMacroCommand.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 07943e3..6f4b930 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -93,7 +93,7 @@ bool cmMacroHelperCommand::InvokeInitialPass( argVs.reserve(expandedArgs.size()); char argvName[60]; for (unsigned int j = 0; j < expandedArgs.size(); ++j) { - sprintf(argvName, "${ARGV%i}", j); + sprintf(argvName, "${ARGV%u}", j); argVs.push_back(argvName); } // Invoke all the functions that were collected in the block. -- cgit v0.12 From 1519628e6042a09cac4733fe09850c61d8c74be1 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Tue, 3 Apr 2018 17:39:11 -0400 Subject: cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned It's used in unsigned contexts, such as with format strings. --- Source/cmVisualStudio10TargetGenerator.cxx | 4 ++-- Source/cmVisualStudio10TargetGenerator.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4bd07ef..28e8b24 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -342,8 +342,8 @@ void cmVisualStudio10TargetGenerator::Generate() if (this->NsightTegra) { this->WriteString("\n", 1); - const int nsightTegraMajorVersion = this->NsightTegraVersion[0]; - const int nsightTegraMinorVersion = this->NsightTegraVersion[1]; + const unsigned int nsightTegraMajorVersion = this->NsightTegraVersion[0]; + const unsigned int nsightTegraMinorVersion = this->NsightTegraVersion[1]; if (nsightTegraMajorVersion >= 2) { this->WriteString("", 2); if (nsightTegraMajorVersion > 3 || diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7106737..de3a8a6 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -203,7 +203,7 @@ private: bool MSTools; bool Managed; bool NsightTegra; - int NsightTegraVersion[4]; + unsigned int NsightTegraVersion[4]; bool TargetCompileAsWinRT; cmGlobalVisualStudio10Generator* const GlobalGenerator; cmGeneratedFileStream* BuildFileStream; -- cgit v0.12 From 418541035f82327ff387363efebcf18de7feffc9 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Tue, 3 Apr 2018 16:59:31 -0400 Subject: cmCTestCurl: Fix UploadFile declared parameter names Match the order used in the definition. --- Source/CTest/cmCTestCurl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h index 427a392..86d9489 100644 --- a/Source/CTest/cmCTestCurl.h +++ b/Source/CTest/cmCTestCurl.h @@ -16,7 +16,7 @@ class cmCTestCurl public: cmCTestCurl(cmCTest*); ~cmCTestCurl(); - bool UploadFile(std::string const& url, std::string const& file, + bool UploadFile(std::string const& local_file, std::string const& url, std::string const& fields, std::string& response); bool HttpRequest(std::string const& url, std::string const& fields, std::string& response); -- cgit v0.12 From acda926a047c5958af32fd6f88dd184f5d769319 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Wed, 4 Apr 2018 07:41:50 -0400 Subject: Replace some uses of sprintf with std::to_string --- Source/cmCacheManager.cxx | 18 +++++++++--------- Source/cmStateSnapshot.cxx | 19 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 85ac985..13407e5 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include "cmGeneratedFileStream.h" #include "cmMessenger.h" @@ -243,19 +244,18 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) } // before writing the cache, update the version numbers // to the - char temp[1024]; - sprintf(temp, "%d", cmVersion::GetMinorVersion()); - this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, - "Minor version of cmake used to create the " + this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", + std::to_string(cmVersion::GetMajorVersion()).c_str(), + "Major version of cmake used to create the " "current loaded cache", cmStateEnums::INTERNAL); - sprintf(temp, "%d", cmVersion::GetMajorVersion()); - this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, - "Major version of cmake used to create the " + this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", + std::to_string(cmVersion::GetMinorVersion()).c_str(), + "Minor version of cmake used to create the " "current loaded cache", cmStateEnums::INTERNAL); - sprintf(temp, "%d", cmVersion::GetPatchVersion()); - this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, + this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", + std::to_string(cmVersion::GetPatchVersion()).c_str(), "Patch version of cmake used to create the " "current loaded cache", cmStateEnums::INTERNAL); diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 479ecd2..0d97c33 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "cmAlgorithms.h" #include "cmDefinitions.h" @@ -328,15 +328,14 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("CMAKE_HOST_SOLARIS", "1"); #endif - char temp[1024]; - sprintf(temp, "%d", cmVersion::GetMinorVersion()); - this->SetDefinition("CMAKE_MINOR_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetMajorVersion()); - this->SetDefinition("CMAKE_MAJOR_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetPatchVersion()); - this->SetDefinition("CMAKE_PATCH_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetTweakVersion()); - this->SetDefinition("CMAKE_TWEAK_VERSION", temp); + this->SetDefinition("CMAKE_MAJOR_VERSION", + std::to_string(cmVersion::GetMajorVersion())); + this->SetDefinition("CMAKE_MINOR_VERSION", + std::to_string(cmVersion::GetMinorVersion())); + this->SetDefinition("CMAKE_PATCH_VERSION", + std::to_string(cmVersion::GetPatchVersion())); + this->SetDefinition("CMAKE_TWEAK_VERSION", + std::to_string(cmVersion::GetTweakVersion())); this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion()); this->SetDefinition("CMAKE_FILES_DIRECTORY", -- cgit v0.12