[Cmake-commits] CMake branch, next, updated. v3.7.1-1711-g942132b

Brad King brad.king at kitware.com
Mon Dec 12 14:08:50 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  942132b500c26d91e557a6cf127d28209480e42a (commit)
       via  b932cd429800bb24d71e1d60f954fe4df2d1eb5c (commit)
       via  88da3d68c2d205688762fd6a7e84fd730533e844 (commit)
       via  58c66393cfb999f23bfb6ff72122ecbc531434c0 (commit)
       via  85bfdddaf75905a2c075d2a94d85f4bcfa1feea9 (commit)
       via  2988abd9390c1d6876610436883d1f7bcd405d8f (commit)
       via  a74e6893480e491959e9165106f199a8cd0edd57 (commit)
       via  cac529dd495f05dcd24d33dd5fa595ff28eb7a60 (commit)
       via  7c9db8f8139b945d4c55d9061e4ef122351b210d (commit)
      from  7554a08895ec9d2754bf159450126be6f5d5ac15 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=942132b500c26d91e557a6cf127d28209480e42a
commit 942132b500c26d91e557a6cf127d28209480e42a
Merge: 7554a08 b932cd4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 12 14:08:46 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Dec 12 14:08:46 2016 -0500

    Merge topic 'clang-tidy' into next
    
    b932cd42 clang-tidy: apply misc-redundant-expression fixes
    88da3d68 clang-tidy: apply misc-suspicious-string-compare fixes
    58c66393 clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes
    85bfddda clang-tidy: apply readability-redundant-control-flow fixes
    2988abd9 clang-tidy: apply modernize-use-bool-literals fixes
    a74e6893 clang-tidy: apply readability-redundant-string-init fixes
    cac529dd clang-tidy: apply performance-faster-string-find fixes
    7c9db8f8 clang-tidy: apply performance-unnecessary-value-param fixes


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b932cd429800bb24d71e1d60f954fe4df2d1eb5c
commit b932cd429800bb24d71e1d60f954fe4df2d1eb5c
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 16:55:49 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:16 2016 -0500

    clang-tidy: apply misc-redundant-expression fixes

diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index fbc94cc..5c45fe5 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -119,10 +119,9 @@ void cmCTestRunTest::CompressOutput()
   strm.next_out = out;
   ret = deflate(&strm, Z_FINISH);
 
-  if (ret == Z_STREAM_ERROR || ret != Z_STREAM_END) {
+  if (ret != Z_STREAM_END) {
     cmCTestLog(this->CTest, ERROR_MESSAGE,
-               "Error during output "
-               "compression. Sending uncompressed output."
+               "Error during output compression. Sending uncompressed output."
                  << std::endl);
     delete[] out;
     return;
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index dfec0fb..559275e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2787,7 +2787,7 @@ bool cmCTest::CompressString(std::string& str)
   strm.next_out = &out[0];
   ret = deflate(&strm, Z_FINISH);
 
-  if (ret == Z_STREAM_ERROR || ret != Z_STREAM_END) {
+  if (ret != Z_STREAM_END) {
     cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression."
                  << std::endl);
     return false;
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index 21a5209..0018263 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -156,7 +156,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text)
 
     // Move to beginning of next word.  Skip over whitespace.
     l = r;
-    while (*l && (*l == ' ')) {
+    while (*l == ' ') {
       ++l;
     }
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88da3d68c2d205688762fd6a7e84fd730533e844
commit 88da3d68c2d205688762fd6a7e84fd730533e844
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 16:49:34 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:16 2016 -0500

    clang-tidy: apply misc-suspicious-string-compare fixes

diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 2c9ca63..1940953 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -597,13 +597,11 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(
 {
   cmsys::Directory dir;
   dir.Load(topdir);
-  size_t fileNum;
-  for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
-    if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
-        strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
-      std::string fullPath = topdir;
-      fullPath += "/";
-      fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
+  for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
+    const char* fileName = dir.GetFile(i);
+    if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
+      std::string const fullPath =
+        std::string(topdir).append("/").append(fileName);
       if (cmsys::SystemTools::FileIsDirectory(fullPath) &&
           !cmsys::SystemTools::FileIsSymlink(fullPath)) {
         if (!this->GetListOfSubdirectories(fullPath.c_str(), dirs)) {
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index e0b3120..f12c9e8 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -806,18 +806,13 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
 
   cmsys::Directory dir;
   dir.Load(binDir);
-  size_t fileNum;
   std::set<std::string> deletedFiles;
-  for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
-    if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
-        strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
-
-      if (deletedFiles.find(dir.GetFile(
-            static_cast<unsigned long>(fileNum))) == deletedFiles.end()) {
-        deletedFiles.insert(dir.GetFile(static_cast<unsigned long>(fileNum)));
-        std::string fullPath = binDir;
-        fullPath += "/";
-        fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
+  for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
+    const char* fileName = dir.GetFile(i);
+    if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
+      if (deletedFiles.insert(fileName).second) {
+        std::string const fullPath =
+          std::string(binDir).append("/").append(fileName);
         if (cmSystemTools::FileIsDirectory(fullPath)) {
           this->CleanupFiles(fullPath.c_str());
           cmSystemTools::RemoveADirectory(fullPath);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58c66393cfb999f23bfb6ff72122ecbc531434c0
commit 58c66393cfb999f23bfb6ff72122ecbc531434c0
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 16:04:43 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:15 2016 -0500

    clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes

diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index a3c13c4..9a90f54 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -38,8 +38,8 @@ std::string cmCTestCurl::Escape(std::string const& source)
 }
 
 namespace {
-static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
-                                      void* data)
+size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
+                               void* data)
 {
   int realsize = (int)(size * nmemb);
 
@@ -49,8 +49,8 @@ static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
   return realsize;
 }
 
-static size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
-                                char* chPtr, size_t size, void* data)
+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/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 34b880e..d10c886 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2343,9 +2343,8 @@ size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb,
   return realsize;
 }
 
-static size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type,
-                                             char* chPtr, size_t size,
-                                             void* data)
+size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
+                                      size_t size, void* data)
 {
   cmFileCommandVectorOfChar* vec =
     static_cast<cmFileCommandVectorOfChar*>(data);
@@ -2414,9 +2413,8 @@ private:
   std::string Text;
 };
 
-static int cmFileDownloadProgressCallback(void* clientp, double dltotal,
-                                          double dlnow, double ultotal,
-                                          double ulnow)
+int cmFileDownloadProgressCallback(void* clientp, double dltotal, double dlnow,
+                                   double ultotal, double ulnow)
 {
   cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp);
 
@@ -2433,9 +2431,8 @@ static int cmFileDownloadProgressCallback(void* clientp, double dltotal,
   return 0;
 }
 
-static int cmFileUploadProgressCallback(void* clientp, double dltotal,
-                                        double dlnow, double ultotal,
-                                        double ulnow)
+int cmFileUploadProgressCallback(void* clientp, double dltotal, double dlnow,
+                                 double ultotal, double ulnow)
 {
   cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp);
 
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index c08a36b..f47cb33 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -32,7 +32,7 @@
 
 namespace {
 
-static std::vector<std::string> getConfigurations(const cmake* cm)
+std::vector<std::string> getConfigurations(const cmake* cm)
 {
   std::vector<std::string> configurations;
   auto makefiles = cm->GetGlobalGenerator()->GetMakefiles();
@@ -47,7 +47,7 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
   return configurations;
 }
 
-static bool hasString(const Json::Value& v, const std::string& s)
+bool hasString(const Json::Value& v, const std::string& s)
 {
   return !v.isNull() &&
     std::find_if(v.begin(), v.end(), [s](const Json::Value& i) {
@@ -56,7 +56,7 @@ static bool hasString(const Json::Value& v, const std::string& s)
 }
 
 template <class T>
-static Json::Value fromStringList(const T& in)
+Json::Value fromStringList(const T& in)
 {
   Json::Value result = Json::arrayValue;
   for (const std::string& i : in) {
@@ -65,7 +65,7 @@ static Json::Value fromStringList(const T& in)
   return result;
 }
 
-static std::vector<std::string> toStringList(const Json::Value& in)
+std::vector<std::string> toStringList(const Json::Value& in)
 {
   std::vector<std::string> result;
   for (const auto& it : in) {
@@ -74,12 +74,11 @@ static std::vector<std::string> toStringList(const Json::Value& in)
   return result;
 }
 
-static void getCMakeInputs(const cmGlobalGenerator* gg,
-                           const std::string& sourceDir,
-                           const std::string& buildDir,
-                           std::vector<std::string>* internalFiles,
-                           std::vector<std::string>* explicitFiles,
-                           std::vector<std::string>* tmpFiles)
+void getCMakeInputs(const cmGlobalGenerator* gg, const std::string& sourceDir,
+                    const std::string& buildDir,
+                    std::vector<std::string>* internalFiles,
+                    std::vector<std::string>* explicitFiles,
+                    std::vector<std::string>* tmpFiles)
 {
   const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/';
   std::vector<cmMakefile*> const& makefiles = gg->GetMakefiles();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85bfdddaf75905a2c075d2a94d85f4bcfa1feea9
commit 85bfdddaf75905a2c075d2a94d85f4bcfa1feea9
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 16:00:29 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:14 2016 -0500

    clang-tidy: apply readability-redundant-control-flow fixes

diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index d1f8446..e78f5fe 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -733,7 +733,6 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
     e << " ." << *ext;
   }
   cmSystemTools::Error(e.str().c_str());
-  return;
 }
 
 void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 1b7180c..e0b3120 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -901,5 +901,4 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
   emsg << cmWrap("  " + this->BinaryDirectory, searchDirs, tmpOutputFile, "\n")
        << "\n";
   this->FindErrorMessage = emsg.str();
-  return;
 }
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index f556a8b..ac4f040 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -180,5 +180,4 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
     }
   }
   fout << "endif()\n";
-  return;
 }
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index b0a4c47..f544e8a 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -137,7 +137,6 @@ void Tree::InsertPath(const std::vector<std::string>& splitted,
   // last part of splitted
   newFolder.files.push_back(fileName);
   folders.push_back(newFolder);
-  return;
 }
 
 void Tree::BuildVirtualFolder(cmXMLWriter& xml) const

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2988abd9390c1d6876610436883d1f7bcd405d8f
commit 2988abd9390c1d6876610436883d1f7bcd405d8f
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 15:17:06 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:14 2016 -0500

    clang-tidy: apply modernize-use-bool-literals fixes

diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index a6d443b..9ca7750 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -28,7 +28,7 @@
       Generator->Logger->Log(logType, __FILE__, __LINE__,                     \
                              cmCPackLog_msg.str().c_str());                   \
     }                                                                         \
-  } while (0)
+  } while (false)
 
 cmCPackIFWInstaller::cmCPackIFWInstaller()
   : Generator(CM_NULLPTR)
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 902c85d..c868a14 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -29,7 +29,7 @@
       Generator->Logger->Log(logType, __FILE__, __LINE__,                     \
                              cmCPackLog_msg.str().c_str());                   \
     }                                                                         \
-  } while (0)
+  } while (false)
 
 //---------------------------------------------------------- CompareStruct ---
 cmCPackIFWPackage::CompareStruct::CompareStruct()
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 8d50e30..cc204e8 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -23,7 +23,7 @@
       Generator->Logger->Log(logType, __FILE__, __LINE__,                     \
                              cmCPackLog_msg.str().c_str());                   \
     }                                                                         \
-  } while (0)
+  } while (false)
 
 cmCPackIFWRepository::cmCPackIFWRepository()
   : Update(None)
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 10a5a36..5354fca 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -30,7 +30,7 @@ class cmMakefile;
     cmCPackLog_msg << msg;                                                    \
     this->Logger->Log(logType, __FILE__, __LINE__,                            \
                       cmCPackLog_msg.str().c_str());                          \
-  } while (0)
+  } while (false)
 
 /** \class cmCPackGenerator
  * \brief A superclass of all CPack Generators
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 419c932..a988ccc 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -14,7 +14,7 @@
     std::ostringstream cmCPackLog_msg;                                        \
     cmCPackLog_msg << msg;                                                    \
     (ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str()); \
-  } while (0)
+  } while (false)
 
 /** \class cmCPackLog
  * \brief A container for CPack generators
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index a455908..3bf54f0 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -948,7 +948,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
   this->BuildOutputLogSize += length;
 
   // until there are any lines left in the buffer
-  while (1) {
+  while (true) {
     // Find the end of line
     t_BuildProcessingQueueType::iterator it;
     for (it = queue->begin(); it != queue->end(); ++it) {
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 0a6bc33..79c3663 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -748,7 +748,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
 {
   if (scp_command.empty() || localprefix.empty() || files.empty() ||
       remoteprefix.empty() || url.empty()) {
-    return 0;
+    return false;
   }
 
   std::vector<const char*> argv;
@@ -852,7 +852,7 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
                << "\tremoteprefix: " << remoteprefix << "\n"
                << "\tdestination: " << destination << std::endl);
     /* clang-format on */
-    return 0;
+    return false;
   }
 
   cmCTest::SetOfStrings::const_iterator file;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 919be4d..ff8e010 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -52,8 +52,7 @@ void onsig(int /*unused*/)
     initscr();            /* Initialization */
     noecho();             /* Echo off */
     cbreak();             /* nl- or cr not needed */
-    keypad(stdscr, TRUE); /* Use key symbols as
-                             KEY_DOWN*/
+    keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
     refresh();
     int x, y;
     getmaxyx(stdscr, y, x);
@@ -128,8 +127,7 @@ int main(int argc, char const* const* argv)
   initscr();            /* Initialization */
   noecho();             /* Echo off */
   cbreak();             /* nl- or cr not needed */
-  keypad(stdscr, TRUE); /* Use key symbols as
-                           KEY_DOWN*/
+  keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
 
   signal(SIGWINCH, onsig);
 
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 4b5b4b1..939c736 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -576,8 +576,7 @@ int cmCursesMainForm::Configure(int noconfigure)
   }
   this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
 
-  keypad(stdscr, TRUE); /* Use key symbols as
-                           KEY_DOWN*/
+  keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
 
   if (retVal != 0 || !this->Errors.empty()) {
     // see if there was an error
@@ -630,8 +629,7 @@ int cmCursesMainForm::Generate()
   int retVal = this->CMakeInstance->Generate();
 
   this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
-  keypad(stdscr, TRUE); /* Use key symbols as
-                           KEY_DOWN*/
+  keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
 
   if (retVal != 0 || !this->Errors.empty()) {
     // see if there was an error
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 6c76764..a9918f7 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -28,9 +28,9 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
 
   move_field(this->Field, y, x);
   if (isNewPage) {
-    set_new_page(this->Field, TRUE);
+    set_new_page(this->Field, true);
   } else {
-    set_new_page(this->Field, FALSE);
+    set_new_page(this->Field, false);
   }
 }
 
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 1527b30..dfec0fb 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1509,7 +1509,7 @@ bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files)
 bool cmCTest::SubmitExtraFiles(const char* cfiles)
 {
   if (!cfiles) {
-    return 1;
+    return true;
   }
 
   VectorOfStrings files;
@@ -1518,7 +1518,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles)
 
   files = cmSystemTools::SplitString(cfiles, ';');
   if (files.empty()) {
-    return 1;
+    return true;
   }
 
   return this->SubmitExtraFiles(files);
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 8fc646f..4d33458 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -27,7 +27,7 @@ class cmXMLWriter;
     cmCTestLog_msg << msg;                                                    \
     (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__,                       \
                   cmCTestLog_msg.str().c_str());                              \
-  } while (0)
+  } while (false)
 
 #define cmCTestOptionalLog(ctSelf, logType, msg, suppress)                    \
   do {                                                                        \
@@ -35,7 +35,7 @@ class cmXMLWriter;
     cmCTestLog_msg << msg;                                                    \
     (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__,                       \
                   cmCTestLog_msg.str().c_str(), suppress);                    \
-  } while (0)
+  } while (false)
 
 /** \class cmCTest
  * \brief Represents a ctest invocation.
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 23f881a..1a5e6c5 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -52,7 +52,7 @@ cmFortranParser_s::cmFortranParser_s(std::vector<std::string> const& includes,
   , PPDefinitions(defines)
   , Info(info)
 {
-  this->InInterface = 0;
+  this->InInterface = false;
   this->InPPFalseBranch = 0;
 
   // Initialize the lexical scanner.
@@ -83,9 +83,9 @@ bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
       cmFortran_yy_create_buffer(CM_NULLPTR, 16384, parser->Scanner);
     cmFortran_yy_switch_to_buffer(buffer, parser->Scanner);
     parser->FileStack.push(f);
-    return 1;
+    return true;
   }
-  return 0;
+  return false;
 }
 
 bool cmFortranParser_FilePop(cmFortranParser* parser)
@@ -93,7 +93,7 @@ bool cmFortranParser_FilePop(cmFortranParser* parser)
   // Pop one file off the stack and close it.  Switch the lexer back
   // to the next one on the stack.
   if (parser->FileStack.empty()) {
-    return 0;
+    return false;
   }
   cmFortranFile f = parser->FileStack.top();
   parser->FileStack.pop();
@@ -101,7 +101,7 @@ bool cmFortranParser_FilePop(cmFortranParser* parser)
   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;
+  return true;
 }
 
 int cmFortranParser_Input(cmFortranParser* parser, char* buffer,
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 1f2d2b4..e70bbfe 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -351,7 +351,8 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input,
     return stripExportInterface(input, context, resolveRelative);
   }
 
-  assert(0 && "cmGeneratorExpression::Preprocess called with invalid args");
+  assert(false &&
+         "cmGeneratorExpression::Preprocess called with invalid args");
   return std::string();
 }
 
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 3a41712..398f95b 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1377,7 +1377,7 @@ cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
 
 #undef RETURN_POLICY
 
-  assert(0 && "Unreachable code. Not a valid policy");
+  assert(false && "Unreachable code. Not a valid policy");
   return cmPolicies::WARN;
 }
 
@@ -1392,7 +1392,7 @@ cmPolicies::PolicyID policyForString(const char* policy_id)
 
 #undef RETURN_POLICY_ID
 
-  assert(0 && "Unreachable code. Not a valid policy");
+  assert(false && "Unreachable code. Not a valid policy");
   return cmPolicies::CMP0002;
 }
 
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index 3b56416..c33349a 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -242,11 +242,11 @@ void cmGeneratorExpressionParser::ParseContent(
       if (this->NestingLevel == 0) {
         extendText(result, this->it);
       } else {
-        assert(0 && "Got unexpected syntax token.");
+        assert(false && "Got unexpected syntax token.");
       }
       assert(this->it != this->Tokens.end());
       ++this->it;
       return;
   }
-  assert(0 && "Unhandled token in generator expression.");
+  assert(false && "Unhandled token in generator expression.");
 }
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6ee2c14..b6db0d6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3389,7 +3389,8 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
 {
   switch (t) {
     case BoolType:
-      assert(0 && "String compatibility check function called for boolean");
+      assert(false &&
+             "String compatibility check function called for boolean");
       return CM_NULLPTR;
     case StringType:
       return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
@@ -3398,7 +3399,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
     case NumberMaxType:
       return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
   }
-  assert(0 && "Unreachable!");
+  assert(false && "Unreachable!");
   return CM_NULLPTR;
 }
 
@@ -3589,7 +3590,7 @@ std::string compatibilityType(CompatibleType t)
     case NumberMinType:
       return "Numeric minimum compatibility";
   }
-  assert(0 && "Unreachable!");
+  assert(false && "Unreachable!");
   return "";
 }
 
@@ -3603,7 +3604,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
     case NumberMinType:
       return dominant ? "(Dominant)\n" : "(Ignored)\n";
   }
-  assert(0 && "Unreachable!");
+  assert(false && "Unreachable!");
   return "";
 }
 
@@ -3713,7 +3714,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
 
   switch (t) {
     case BoolType:
-      assert(0 && "consistentProperty for strings called with BoolType");
+      assert(false && "consistentProperty for strings called with BoolType");
       return std::pair<bool, const char*>(false, null_ptr);
     case StringType:
       return consistentStringProperty(lhs, rhs);
@@ -3721,7 +3722,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
     case NumberMaxType:
       return consistentNumberProperty(lhs, rhs, t);
   }
-  assert(0 && "Unreachable!");
+  assert(false && "Unreachable!");
   return std::pair<bool, const char*>(false, null_ptr);
 }
 
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 4dfa40f..88fcc56 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -97,7 +97,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
     case cmStateEnums::INTERFACE_LIBRARY:
       // Not reachable. We never create a cmInstallTargetGenerator for
       // an INTERFACE_LIBRARY.
-      assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
+      assert(false &&
+             "INTERFACE_LIBRARY targets have no installable outputs.");
       break;
     case cmStateEnums::OBJECT_LIBRARY:
     case cmStateEnums::UTILITY:
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6c5b2b2..0db5687 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -538,7 +538,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
     case cmStateEnums::EXECUTABLE:
       break;
     default:
-      assert(0 && "Unexpected target type");
+      assert(false && "Unexpected target type");
   }
   return std::vector<std::string>();
 }
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 6e934e2..18d5ea1 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -58,7 +58,7 @@ const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
     case cmStateEnums::UNKNOWN_LIBRARY:
       return "UNKNOWN_LIBRARY";
   }
-  assert(0 && "Unexpected target type");
+  assert(false && "Unexpected target type");
   return CM_NULLPTR;
 }
 
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 029594f..a635bf4 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1664,7 +1664,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
   std::vector<char>::iterator erriter = err.begin();
   cmProcessOutput processOutput;
   std::string strdata;
-  while (1) {
+  while (true) {
     // Check for a newline in stdout.
     for (; outiter != out.end(); ++outiter) {
       if ((*outiter == '\r') && ((outiter + 1) == out.end())) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f1ce75a..5b12a75 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -169,13 +169,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         return 1;
       }
       // If error occurs we want to continue copying next files.
-      bool return_value = 0;
+      bool return_value = false;
       for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
         if (!cmSystemTools::cmCopyFile(args[cc].c_str(),
                                        args[args.size() - 1].c_str())) {
           std::cerr << "Error copying file \"" << args[cc] << "\" to \""
                     << args[args.size() - 1] << "\".\n";
-          return_value = 1;
+          return_value = true;
         }
       }
       return return_value;
@@ -192,13 +192,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         return 1;
       }
       // If error occurs we want to continue copying next files.
-      bool return_value = 0;
+      bool return_value = false;
       for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
         if (!cmSystemTools::CopyFileIfDifferent(
               args[cc].c_str(), args[args.size() - 1].c_str())) {
           std::cerr << "Error copying file (if different) from \"" << args[cc]
                     << "\" to \"" << args[args.size() - 1] << "\".\n";
-          return_value = 1;
+          return_value = true;
         }
       }
       return return_value;
@@ -207,12 +207,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     // Copy directory content
     if (args[1] == "copy_directory" && args.size() > 3) {
       // If error occurs we want to continue copying next files.
-      bool return_value = 0;
+      bool return_value = false;
       for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
         if (!cmSystemTools::CopyADirectory(args[cc], args[args.size() - 1])) {
           std::cerr << "Error copying directory from \"" << args[cc]
                     << "\" to \"" << args[args.size() - 1] << "\".\n";
-          return_value = 1;
+          return_value = true;
         }
       }
       return return_value;
@@ -479,11 +479,11 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
     if (args[1] == "make_directory" && args.size() > 2) {
       // If error occurs we want to continue copying next files.
-      bool return_value = 0;
+      bool return_value = false;
       for (std::string::size_type cc = 2; cc < args.size(); cc++) {
         if (!cmSystemTools::MakeDirectory(args[cc].c_str())) {
           std::cerr << "Error creating directory \"" << args[cc] << "\".\n";
-          return_value = 1;
+          return_value = true;
         }
       }
       return return_value;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a74e6893480e491959e9165106f199a8cd0edd57
commit a74e6893480e491959e9165106f199a8cd0edd57
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 14:53:06 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:13 2016 -0500

    clang-tidy: apply readability-redundant-string-init fixes

diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index b7ac969..989c096 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -977,7 +977,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
 
   std::set<std::string> missingFiles;
 
-  std::string actualSourceFile = "";
+  std::string actualSourceFile;
   cmCTestOptionalLog(
     this->CTest, HANDLER_OUTPUT,
     "   Processing coverage (each . represents one file):" << std::endl,
@@ -1006,8 +1006,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
     cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                        command << std::endl, this->Quiet);
 
-    std::string output = "";
-    std::string errors = "";
+    std::string output;
+    std::string errors;
     int retVal = 0;
     *cont->OFS << "* Run coverage for: " << fileDir << std::endl;
     *cont->OFS << "  Command: " << command << std::endl;
@@ -1344,7 +1344,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
 
   std::set<std::string> missingFiles;
 
-  std::string actualSourceFile = "";
+  std::string actualSourceFile;
   cmCTestOptionalLog(
     this->CTest, HANDLER_OUTPUT,
     "   Processing coverage (each . represents one file):" << std::endl,
@@ -1371,8 +1371,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
     cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                        command << std::endl, this->Quiet);
 
-    std::string output = "";
-    std::string errors = "";
+    std::string output;
+    std::string errors;
     int retVal = 0;
     *cont->OFS << "* Run coverage for: " << fileDir << std::endl;
     *cont->OFS << "  Command: " << command << std::endl;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 1766aef..c1724ab 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -256,7 +256,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
   bool allTestsFailedTestLoadCheck = false;
   bool usedFakeLoadForTesting = false;
   size_t minProcessorsRequired = this->ParallelLevel;
-  std::string testWithMinProcessors = "";
+  std::string testWithMinProcessors;
 
   cmsys::SystemInformation info;
 
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 0f13c1e..0a6bc33 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -388,7 +388,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
       *this->LogFile << "\tUpload file: " << local_file << " to "
                      << remote_file << std::endl;
 
-      std::string ofile = "";
+      std::string ofile;
       for (kk = 0; kk < remote_file.size(); kk++) {
         char c = remote_file[kk];
         char hexCh[4] = { 0, 0, 0, 0 };
@@ -582,7 +582,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
 void cmCTestSubmitHandler::ParseResponse(
   cmCTestSubmitHandlerVectorOfChar chunk)
 {
-  std::string output = "";
+  std::string output;
   output.append(chunk.begin(), chunk.end());
 
   if (output.find("<cdash") != output.npos) {
@@ -662,7 +662,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files,
       ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug);
 
       std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file);
-      std::string ofile = "";
+      std::string ofile;
       std::string::iterator kk;
       for (kk = rfile.begin(); kk < rfile.end(); ++kk) {
         char c = *kk;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 68f9a54..4e63654 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -718,7 +718,7 @@ void cmCTestTestHandler::ComputeTestList()
   // Now create a final list of tests to run
   int cnt = 0;
   inREcnt = 0;
-  std::string last_directory = "";
+  std::string last_directory;
   ListOfTests finalList;
   for (it = this->TestList.begin(); it != this->TestList.end(); it++) {
     cnt++;
@@ -1649,7 +1649,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
   int numFiles =
     static_cast<int>(cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
   std::string pattern = "LastTestsFailed";
-  std::string logName = "";
+  std::string logName;
 
   for (int i = 0; i < numFiles; ++i) {
     std::string fileName = directory.GetFile(i);
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 0b6d3ce..db17748 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -54,7 +54,7 @@ protected:
   void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
   {
     std::string FoundSource;
-    std::string finalpath = "";
+    std::string finalpath;
     if (name == "source") {
       this->InSource = true;
     } else if (name == "sources") {
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index b5d68d0..f5998ef 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
 void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
   std::vector<std::string>* files, const char* prefix, const char* sep) const
 {
-  std::string rname = "";
+  std::string rname;
   if (prefix) {
     rname += prefix;
     rname += sep;
@@ -341,7 +341,7 @@ int cmDependsJavaParserHelper::ParseFile(const char* file)
     return 0;
   }
 
-  std::string fullfile = "";
+  std::string fullfile;
   std::string line;
   while (cmSystemTools::GetLineFromStream(ifs, line)) {
     fullfile += line + "\n";
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index dab0c2c..b443fb0 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -69,7 +69,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
   const cmGeneratorTarget* target, std::ostream& os,
   const ImportPropertyMap& properties)
 {
-  std::string config = "";
+  std::string config;
   if (!this->Configurations.empty()) {
     config = this->Configurations[0];
   }
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index 9772f49..9a1c647 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -67,7 +67,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
   os << targetName << "\n";
   os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
   os << target->Target->GetProperty("__dest") << "/";
-  std::string config = "";
+  std::string config;
   if (!this->Configurations.empty()) {
     config = this->Configurations[0];
   }
@@ -94,7 +94,7 @@ void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
   cmGeneratorTarget const* target, std::ostream& os,
   const ImportPropertyMap& properties)
 {
-  std::string config = "";
+  std::string config;
   if (!this->Configurations.empty()) {
     config = this->Configurations[0];
   }
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 5712ab2..dfefefe 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -172,7 +172,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
   cmGeneratedFileStream& fout, MapSourceFileFlags& sourceFileFlags)
 {
   std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
-  std::string compiler = "";
+  std::string compiler;
   if (!lgs.empty()) {
     this->AppendTarget(fout, "all", lgs[0], CM_NULLPTR, make.c_str(), mf,
                        compiler.c_str(), sourceFileFlags, true);
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 1e8ca06..ff78f52 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -71,7 +71,7 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
       commandLines.push_back(commandLine);
 
       // Add command for generating the .h and .cxx files
-      std::string no_main_dependency = "";
+      std::string no_main_dependency;
       const char* no_comment = CM_NULLPTR;
       const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 2f6238b..34b880e 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -768,7 +768,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
     }
   }
 
-  std::string output = "";
+  std::string output;
   bool first = true;
   for (; i != args.end(); ++i) {
     if (*i == "LIST_DIRECTORIES") {
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 2c496ba..ea031cf 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -116,7 +116,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
 
 std::string cmFindProgramCommand::FindProgram()
 {
-  std::string program = "";
+  std::string program;
 
   if (this->SearchAppBundleFirst || this->SearchAppBundleOnly) {
     program = FindAppBundle();
@@ -214,7 +214,7 @@ std::string cmFindProgramCommand::FindAppBundle()
 
 std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath)
 {
-  std::string executable = "";
+  std::string executable;
   (void)bundlePath;
 #if defined(__APPLE__)
   // Started with an example on developer.apple.com about finding bundles
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f52fe26..fccb486 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -961,7 +961,7 @@ void cmMakefile::AddCustomCommandOldStyle(
                                           commandLines, comment, CM_NULLPTR);
     } else {
       // The source may not be a real file.  Do not use a main dependency.
-      std::string no_main_dependency = "";
+      std::string no_main_dependency;
       std::vector<std::string> depends2 = depends;
       depends2.push_back(source);
       sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
@@ -1051,7 +1051,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
     force += utilityName;
     std::vector<std::string> forced;
     forced.push_back(force);
-    std::string no_main_dependency = "";
+    std::string no_main_dependency;
     bool no_replace = false;
     this->AddCustomCommandToOutput(
       forced, byproducts, depends, no_main_dependency, commandLines, comment,
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8090542..04a46af 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -495,7 +495,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
       this->GetMakefile()->GetRequiredDefinition(ppVar);
 
     // Explicit preprocessing always uses a depfile.
-    std::string const ppDeptype = ""; // no deps= for multiple outputs
+    std::string const ppDeptype; // no deps= for multiple outputs
     std::string const ppDepfile = "$DEP_FILE";
 
     cmRulePlaceholderExpander::RuleVariables ppVars;
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index b0ff68d..de9e545 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -77,7 +77,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
       depends.push_back(moc_exe);
       depends.push_back(hname);
 
-      std::string no_main_dependency = "";
+      std::string no_main_dependency;
       const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
         newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 052e633..d3c6631 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -108,7 +108,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
 
       std::vector<std::string> depends;
       depends.push_back(uiName);
-      std::string no_main_dependency = "";
+      std::string no_main_dependency;
       const char* no_comment = CM_NULLPTR;
       const char* no_working_dir = CM_NULLPTR;
       this->Makefile->AddCustomCommandToOutput(
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index eb513e5..a9a9c49 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -110,7 +110,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
   , GenerateAll(false)
 {
 
-  std::string colorEnv = "";
+  std::string colorEnv;
   cmsys::SystemTools::GetEnv("COLOR", colorEnv);
   if (!colorEnv.empty()) {
     if (cmSystemTools::IsOn(colorEnv.c_str())) {
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 48c086f..eb94080 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -150,7 +150,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
   }
   std::string::size_type cc;
   std::string outvar = args[args.size() - 1];
-  std::string output = "";
+  std::string output;
   for (cc = 1; cc < args.size() - 1; cc++) {
     int ch = atoi(args[cc].c_str());
     if (ch > 0 && ch < 256) {
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index 589f195..4a97114 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -82,7 +82,7 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
 #else
   // From Linux timegm() manpage.
 
-  std::string tz_old = "";
+  std::string tz_old;
   cmSystemTools::GetEnv("TZ", tz_old);
   tz_old = "TZ=" + tz_old;
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cac529dd495f05dcd24d33dd5fa595ff28eb7a60
commit cac529dd495f05dcd24d33dd5fa595ff28eb7a60
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 14:49:22 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:13 2016 -0500

    clang-tidy: apply performance-faster-string-find fixes

diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 4e656aa..56f33b4 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -154,7 +154,7 @@ bool cmAddCustomTargetCommand::InitialPass(
   bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) &&
     !cmGlobalGenerator::IsReservedTarget(targetName);
   if (nameOk) {
-    nameOk = targetName.find(":") == std::string::npos;
+    nameOk = targetName.find(':') == std::string::npos;
   }
   if (!nameOk) {
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 2a0bb15..aae1085 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -61,7 +61,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
     !cmGlobalGenerator::IsReservedTarget(exename);
 
   if (nameOk && !importTarget && !isAlias) {
-    nameOk = exename.find(":") == std::string::npos;
+    nameOk = exename.find(':') == std::string::npos;
   }
   if (!nameOk) {
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 5c9c744..9ae4ace 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -173,7 +173,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
     !cmGlobalGenerator::IsReservedTarget(libName);
 
   if (nameOk && !importTarget && !isAlias) {
-    nameOk = libName.find(":") == std::string::npos;
+    nameOk = libName.find(':') == std::string::npos;
   }
   if (!nameOk) {
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index ecff0c3..7cfa4d8 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -49,7 +49,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
     for (size_t i = 0; i < numfiles; ++i) {
       std::string file = dir.GetFile(static_cast<unsigned long>(i));
       // Split the filename into base and extension
-      std::string::size_type dotpos = file.rfind(".");
+      std::string::size_type dotpos = file.rfind('.');
       if (dotpos != std::string::npos) {
         std::string ext = file.substr(dotpos + 1);
         std::string base = file.substr(0, dotpos);
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 0900f46..8d4bcf3 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -72,7 +72,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
 {
   std::string fileName = file;
   std::string frameWorkName;
-  std::string::size_type pos = fileName.find("/");
+  std::string::size_type pos = fileName.find('/');
   // if there is a / in the name try to find the header as a framework
   // For example bar/foo.h would look for:
   // bar.framework/Headers/foo.h
@@ -83,7 +83,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
     frameWorkName =
       frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
     // if the framework has a path in it then just use the filename
-    if (frameWorkName.find("/") != frameWorkName.npos) {
+    if (frameWorkName.find('/') != frameWorkName.npos) {
       fileName = file;
       frameWorkName = "";
     }
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 603c990..48c086f 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -342,7 +342,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
   std::vector<RegexReplacement> replacement;
   std::string::size_type l = 0;
   while (l < replace.length()) {
-    std::string::size_type r = replace.find("\\", l);
+    std::string::size_type r = replace.find('\\', l);
     if (r == std::string::npos) {
       r = replace.length();
       replacement.push_back(replace.substr(l, r - l));

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c9db8f8139b945d4c55d9061e4ef122351b210d
commit 7c9db8f8139b945d4c55d9061e4ef122351b210d
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Dec 10 14:42:49 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 12 14:04:12 2016 -0500

    clang-tidy: apply performance-unnecessary-value-param fixes

diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 22f69fa..7c683ad 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -242,7 +242,7 @@ std::string cmJoin(Range const& r, const char* delimiter)
 }
 
 template <typename Range>
-std::string cmJoin(Range const& r, std::string delimiter)
+std::string cmJoin(Range const& r, std::string const& delimiter)
 {
   return cmJoin(r, delimiter.c_str());
 }
@@ -344,13 +344,13 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
 }
 
 template <typename Range>
-std::string cmWrap(std::string prefix, Range const& r, std::string suffix,
-                   std::string sep)
+std::string cmWrap(std::string const& prefix, Range const& r,
+                   std::string const& suffix, std::string const& sep)
 {
   if (r.empty()) {
     return std::string();
   }
-  return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix;
+  return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
 }
 
 template <typename Range>
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 8db2e5f..8fc646f 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -242,7 +242,7 @@ public:
 
   /** Used for parallel ctest job scheduling */
   std::string GetScheduleType() { return this->ScheduleType; }
-  void SetScheduleType(std::string type) { this->ScheduleType = type; }
+  void SetScheduleType(std::string const& type) { this->ScheduleType = type; }
 
   /** The max output width */
   int GetMaxTestNameWidth() const;
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 122e9cf..41bea9b 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -65,13 +65,15 @@ private:
 struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
 {
   GeneratorExpressionContent(const char* startContent, size_t length);
-  void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier)
+  void SetIdentifier(
+    std::vector<cmGeneratorExpressionEvaluator*> const& identifier)
   {
     this->IdentifierChildren = identifier;
   }
 
   void SetParameters(
-    std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters)
+    std::vector<std::vector<cmGeneratorExpressionEvaluator*> > const&
+      parameters)
   {
     this->ParamChildren = parameters;
   }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index fdca78a..901ca35 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -148,7 +148,7 @@ public:
   void AppendDefines(std::set<std::string>& defines,
                      const char* defines_list) const;
   void AppendDefines(std::set<std::string>& defines,
-                     std::string defines_list) const
+                     std::string const& defines_list) const
   {
     this->AppendDefines(defines, defines_list.c_str());
   }
diff --git a/Source/cmProcessOutput.cxx b/Source/cmProcessOutput.cxx
index 8b4d0e1..617e1ca 100644
--- a/Source/cmProcessOutput.cxx
+++ b/Source/cmProcessOutput.cxx
@@ -9,7 +9,8 @@ unsigned int cmProcessOutput::defaultCodepage =
   KWSYS_ENCODING_DEFAULT_CODEPAGE;
 #endif
 
-cmProcessOutput::Encoding cmProcessOutput::FindEncoding(std::string name)
+cmProcessOutput::Encoding cmProcessOutput::FindEncoding(
+  std::string const& name)
 {
   Encoding encoding = Auto;
   if (name == "UTF8") {
@@ -54,9 +55,13 @@ cmProcessOutput::~cmProcessOutput()
 bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
                                  size_t id)
 {
+#if !defined(_WIN32)
+  static_cast<void>(id);
+  decoded.swap(raw);
+  return true;
+#else
   bool success = true;
   decoded = raw;
-#if defined(_WIN32)
   if (id > 0) {
     if (rawparts.size() < id) {
       rawparts.reserve(id);
@@ -113,10 +118,8 @@ bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
       success = DoDecodeText(raw, decoded, NULL);
     }
   }
-#else
-  static_cast<void>(id);
-#endif
   return success;
+#endif
 }
 
 bool cmProcessOutput::DecodeText(const char* data, size_t length,
diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h
index 6046f57..d2e631f 100644
--- a/Source/cmProcessOutput.h
+++ b/Source/cmProcessOutput.h
@@ -32,7 +32,7 @@ public:
   * \param name a encoding name.
   * \return encoding enum value or Auto if \a name was not found.
   */
-  static Encoding FindEncoding(std::string name);
+  static Encoding FindEncoding(std::string const& name);
 
   /// The code page that is used as internal encoding to which we will encode.
   static unsigned int defaultCodepage;

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list