From 443180fb9915eefe0b232875505632ffb9fabb95 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 5 Nov 2016 23:44:29 +0100 Subject: cmCPluginAPI: Fix clang-tidy findings --- Source/cmCPluginAPI.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index b70074e..d1f8446 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -408,7 +408,7 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source, std::string result = mf->ExpandVariablesInString( barf, (escapeQuotes ? true : false), (atOnly ? true : false)); char* res = static_cast(malloc(result.size() + 1)); - if (result.size()) { + if (!result.empty()) { strcpy(res, result.c_str()); } res[result.size()] = '\0'; @@ -570,7 +570,7 @@ void* CCONV cmAddSource(void* arg, void* arg2) rsf->GetProperties() = osf->Properties; for (std::vector::iterator i = osf->Depends.begin(); i != osf->Depends.end(); ++i) { - rsf->AddDepend(i->c_str()); + rsf->AddDepend(*i); } // Create the proxy for the real source file. @@ -676,7 +676,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, std::string hname = pathname; if (cmSystemTools::FileExists(hname.c_str())) { sf->SourceName = cmSystemTools::GetFilenamePath(name); - if (sf->SourceName.size() > 0) { + if (!sf->SourceName.empty()) { sf->SourceName += "/"; } sf->SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name); @@ -756,7 +756,7 @@ void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir, fname += "."; fname += ext; } - sf->FullPath = cmSystemTools::CollapseFullPath(fname.c_str(), dir); + sf->FullPath = cmSystemTools::CollapseFullPath(fname, dir); cmSystemTools::ConvertToUnixSlashes(sf->FullPath); sf->SourceExtension = ext; } -- cgit v0.12 From 5ae3966d75593b05a9658af8d2fdd47c2bf48a4d Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 5 Nov 2016 23:46:24 +0100 Subject: cmCTestSubmitHandler: Remove redundant c_str() --- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index d21471d..d10f7ad 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -926,7 +926,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( return false; } size_t fileSize = static_cast(st.st_size); - FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); + FILE* fp = cmsys::SystemTools::Fopen(local_file, "rb"); if (!fp) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot open file: " << local_file << std::endl); -- cgit v0.12 From 1e994985d83b09d71b4928a61a75d1cf3861aaec Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 5 Nov 2016 23:51:30 +0100 Subject: cmGlobalNinjaGenerator: Suppress clang-tidy warning --- Source/cmGlobalNinjaGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 830ab7f..22de7c4 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -130,7 +130,7 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit) std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) { - std::string result = path; + std::string result = path; // NOLINT(clang-tidy) #ifdef _WIN32 if (this->IsGCCOnWindows()) std::replace(result.begin(), result.end(), '\\', '/'); @@ -283,7 +283,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps, const cmNinjaDeps& orderOnly) { - std::string cmd = command; + std::string cmd = command; // NOLINT(clang-tidy) #ifdef _WIN32 if (cmd.empty()) // TODO Shouldn't an empty command be handled by ninja? -- cgit v0.12 From bac93dcf192d8680cd72570682d6593da9818088 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 5 Nov 2016 23:54:57 +0100 Subject: cmGeneratorTarget: Don't assing a bool to a string --- Source/cmGeneratorTarget.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ca056c0..ca3e373 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3945,7 +3945,6 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory( std::string const& working_dir) const { if (!this->FortranModuleDirectoryCreated) { - this->FortranModuleDirectory = true; this->FortranModuleDirectory = this->CreateFortranModuleDirectory(working_dir); } -- cgit v0.12 From 0cd654c8e23b19311bae876ada4ad5b432c1ad1b Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 6 Nov 2016 00:11:03 +0100 Subject: cmGeneratorTarget: Correctly set FortranModuleDirectoryCreated --- Source/cmGeneratorTarget.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ca3e373..f5db7f6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3947,6 +3947,7 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory( if (!this->FortranModuleDirectoryCreated) { this->FortranModuleDirectory = this->CreateFortranModuleDirectory(working_dir); + this->FortranModuleDirectoryCreated = true; } return this->FortranModuleDirectory; -- cgit v0.12