[Cmake-commits] CMake branch, next, updated. v3.2.0-rc1-435-g08a867e

Stephen Kelly steveire at gmail.com
Wed Feb 18 18:24:45 EST 2015


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  08a867e5cdb2832180539d57f2ec28e4b0a4faba (commit)
       via  301091557d3d93589075159d7a9d18d01c07b359 (commit)
       via  8c944e8263ded6f14af1d151f44eb9b48a84ac98 (commit)
       via  c8a451328e624c59afc4a9fd8fab06f274eff4a7 (commit)
       via  b7b4ffe7cb77397923fd56b78f994ae057dc74ff (commit)
       via  41488e6aa5161adbcf50597842d2dc43ae186792 (commit)
       via  0cf5953ef267c2713b41ce878343c9be643ced0a (commit)
       via  10c2ddfabf9168555c8b417d00daaa138df479f2 (commit)
       via  d0906b1677a518037193145f40288bb996ba188f (commit)
       via  f1dcc821fe84e59a37119fd204afde366e6984c0 (commit)
       via  8f3f372a9cff17d22e2ba0bd5fcf684e671d60e2 (commit)
       via  f20a4257f2889387fcbf540b29b16f10843f2f9e (commit)
       via  ee269f4f16300b0427c1e1baef94b85ccc4ea13f (commit)
       via  470cff497bc26d48ee05de0b260af2546bb7698c (commit)
       via  e6ca1b82744154fa048634abdc353e4118a11979 (commit)
      from  5176fba24d5666f2c1bec468a41c416dbdd99167 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08a867e5cdb2832180539d57f2ec28e4b0a4faba
commit 08a867e5cdb2832180539d57f2ec28e4b0a4faba
Merge: 5176fba 3010915
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 18:24:40 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 18 18:24:40 2015 -0500

    Merge topic 'use-algorithms' into next
    
    30109155 cmGlobalGenerator: Convert set insert algorithm to vector algorithms.
    8c944e82 Convert some raw loops to cmWrap.
    c8a45132 cmAlgorithms: Add cmWrap.
    b7b4ffe7 Use cmJoin where possible.
    41488e6a cmCacheManager: Replace loop with algorithm.
    0cf5953e cmGlobalGenerator: Replace loop with algorithm.
    10c2ddfa cmTarget: Port loop to algorithm.
    d0906b16 cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates.
    f1dcc821 cmGeneratorTarget: Replace set insert algorithm with cmRemoveDuplicates.
    8f3f372a cmLocalGenerator: Convert loop to algorithm.
    f20a4257 cmMakefile: Add flag to result and manipulate in place.
    ee269f4f cmMakefile: Replace two loops with std::replace.
    470cff49 cmMakefile: Replace loop with composed algorithm.
    e6ca1b82 cmCTest: Convert loop to member insert.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=301091557d3d93589075159d7a9d18d01c07b359
commit 301091557d3d93589075159d7a9d18d01c07b359
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 23:29:18 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 19 00:23:26 2015 +0100

    cmGlobalGenerator: Convert set insert algorithm to vector algorithms.
    
    Adjust test for new error output.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ac4489a..3baffd3 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -3022,7 +3022,7 @@ void cmGlobalGenerator::AddEvaluationFile(const std::string &inputFile,
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::ProcessEvaluationFiles()
 {
-  std::set<std::string> generatedFiles;
+  std::vector<std::string> generatedFiles;
   for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
       li = this->EvaluationFiles.begin();
       li != this->EvaluationFiles.end();
@@ -3034,16 +3034,24 @@ void cmGlobalGenerator::ProcessEvaluationFiles()
       return;
       }
     std::vector<std::string> files = (*li)->GetFiles();
-    for(std::vector<std::string>::const_iterator fi = files.begin();
-        fi != files.end(); ++fi)
+    std::sort(files.begin(), files.end());
+
+    std::vector<std::string> intersection;
+    std::set_intersection(files.begin(), files.end(),
+                          generatedFiles.begin(), generatedFiles.end(),
+                          std::back_inserter(intersection));
+    if (!intersection.empty())
       {
-      if (!generatedFiles.insert(*fi).second)
-        {
-        cmSystemTools::Error("File to be generated by multiple different "
-          "commands: ", fi->c_str());
-        return;
-        }
+      cmSystemTools::Error("Files to be generated by multiple different "
+        "commands: ", cmWrap("\"", intersection, "\"", " ").c_str());
+      return;
       }
+
+        generatedFiles.insert(generatedFiles.end(),
+                              files.begin(), files.end());
+    std::vector<std::string>::iterator newIt =
+        generatedFiles.end() - files.size();
+    std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end());
     }
 }
 
diff --git a/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt b/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt
index da97ba4..4fa3f20 100644
--- a/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt
+++ b/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt
@@ -1 +1 @@
-CMake Error: File to be generated by multiple different commands: .*CommandConflict-build/output_.*.txt
+CMake Error: Files to be generated by multiple different commands: ".*CommandConflict-build/output_.*.txt"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c944e8263ded6f14af1d151f44eb9b48a84ac98
commit 8c944e8263ded6f14af1d151f44eb9b48a84ac98
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 22:14:26 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 19 00:20:05 2015 +0100

    Convert some raw loops to cmWrap.

diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 8652690..be28b2f 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -705,10 +705,7 @@ void cmComputeLinkDepends::DisplayConstraintGraph()
     {
     EdgeList const& nl = this->EntryConstraintGraph[i];
     e << "item " << i << " is [" << this->EntryList[i].Item << "]\n";
-    for(EdgeList::const_iterator j = nl.begin(); j != nl.end(); ++j)
-      {
-      e << "  item " << *j << " must follow it\n";
-      }
+    e << cmWrap("  item ", nl, " must follow it", "\n") << "\n";
     }
   fprintf(stderr, "%s\n", e.str().c_str());
 }
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bcd2d81..e9390e4 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -683,11 +683,9 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
 
   std::ostringstream emsg;
   emsg << "Unable to find the executable at any of:\n";
-  for (unsigned int i = 0; i < searchDirs.size(); ++i)
-    {
-    emsg << "  " << this->BinaryDirectory << searchDirs[i]
-         << tmpOutputFile << "\n";
-    }
+  emsg << cmWrap("  " + this->BinaryDirectory,
+                 searchDirs,
+                 tmpOutputFile, "\n") << "\n";
   this->FindErrorMessage = emsg.str();
   return;
 }
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index fd3aa0b..6fe055a 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -355,11 +355,7 @@ void cmFindBase::PrintFindStuff()
   std::cerr << "SearchPathSuffixes  ";
   std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n";
   std::cerr << "SearchPaths\n";
-  for(std::vector<std::string>::const_iterator i = this->SearchPaths.begin();
-      i != this->SearchPaths.end(); ++i)
-    {
-    std::cerr << "[" << *i << "]\n";
-    }
+  std::cerr << cmWrap("[", this->SearchPaths, "]", "\n") << "\n";
 }
 
 bool cmFindBase::CheckForVariableInCache()
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index fd9b236..26bd4b9 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -329,10 +329,7 @@ bool cmFindPackageCommand
     {
     std::ostringstream e;
     e << "called with components that are both required and optional:\n";
-    for(unsigned int i=0; i<doubledComponents.size(); ++i)
-      {
-      e << "  " << doubledComponents[i] << "\n";
-      }
+    e << cmWrap("  ", doubledComponents, "", "\n") << "\n";
     this->SetError(e.str());
     return false;
     }
@@ -808,13 +805,8 @@ bool cmFindPackageCommand::HandlePackageMode()
           {
           e << "Could not find a package configuration file provided by \""
             << this->Name << "\"" << requestedVersionString
-            << " with any of the following names:\n";
-          for(std::vector<std::string>::const_iterator ci =
-                this->Configs.begin();
-              ci != this->Configs.end(); ++ci)
-            {
-            e << "  " << *ci << "\n";
-            }
+            << " with any of the following names:\n"
+            << cmWrap("  ", this->Configs, "", "\n") << "\n";
           }
 
         e << "Add the installation prefix of \"" << this->Name << "\" to "
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 6fd569e..813e97d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -213,13 +213,7 @@ cmMakefile::~cmMakefile()
 void cmMakefile::PrintStringVector(const char* s,
                                    const std::vector<std::string>& v) const
 {
-  std::cout << s << ": ( \n";
-  for(std::vector<std::string>::const_iterator i = v.begin();
-      i != v.end(); ++i)
-    {
-    std::cout << *i << " ";
-    }
-  std::cout << " )\n";
+  std::cout << s << ": ( \n" << cmWrap("\"", v, "\"", " ") << ")\n";
 }
 
 void cmMakefile
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index c913ea9..37f9a8f 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -213,27 +213,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     // Echo string
     else if (args[1] == "echo" )
       {
-      unsigned int cc;
-      const char* space = "";
-      for ( cc = 2; cc < args.size(); cc ++ )
-        {
-        std::cout << space << args[cc];
-        space = " ";
-        }
-      std::cout << std::endl;
+      std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl;
       return 0;
       }
 
     // Echo string no new line
     else if (args[1] == "echo_append" )
       {
-      unsigned int cc;
-      const char* space = "";
-      for ( cc = 2; cc < args.size(); cc ++ )
-        {
-        std::cout << space << args[cc];
-        space = " ";
-        }
+      std::cout << cmJoin(cmRange(args).advance(2), " ");
       return 0;
       }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8a451328e624c59afc4a9fd8fab06f274eff4a7
commit c8a451328e624c59afc4a9fd8fab06f274eff4a7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 23:50:36 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmAlgorithms: Add cmWrap.
    
    Port some existing cmJoin to use it.
    
    cmJoin is cumbersome to use in cases where the objective is to
    somehow 'quote' each item and then join it with a separator.  In that
    case, the joiner string is harder to read and reason about.  cmWrap
    aims to solve that.

diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 8491838..54dc14a 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -278,4 +278,15 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
   return cmRemoveIndices(r, indices);
 }
 
+template<typename Range>
+std::string cmWrap(std::string prefix, Range const& r, std::string suffix,
+                   std::string sep)
+{
+   if (r.empty())
+     {
+     return std::string();
+     }
+  return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix;
+}
+
 #endif
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a7cfda7..391a965 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -724,12 +724,7 @@ cmLocalUnixMakefileGenerator3
     }
 
   // Write the list of commands.
-  for(std::vector<std::string>::const_iterator i = commands.begin();
-      i != commands.end(); ++i)
-    {
-    replace = *i;
-    os << "\t" << replace << "\n";
-    }
+  os << cmWrap("\t", commands, "", "\n") << "\n";
   if(symbolic && !this->WatcomWMake)
     {
     os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index bf496e9..bc5be33 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -835,7 +835,7 @@ cmSystemTools::PrintSingleCommand(std::vector<std::string> const& command)
     return std::string();
     }
 
-  return "\"" + cmJoin(command, "\" \"") + "\"";
+  return cmWrap("\"", command, "\"", " ");
 }
 
 bool cmSystemTools::DoesFileExistWithExtensions(
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 81582f5..c913ea9 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -463,9 +463,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         return 1;
         }
 
-      std::string command = "\"";
-      command += cmJoin(cmRange(args).advance(3), "\" \"");
-      command += "\"";
+      std::string command = cmWrap("\"", cmRange(args).advance(3), "\"", " ");
       int retval = 0;
       int timeout = 0;
       if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b7b4ffe7cb77397923fd56b78f994ae057dc74ff
commit b7b4ffe7cb77397923fd56b78f994ae057dc74ff
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 12 20:53:43 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    Use cmJoin where possible.

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 8e20c14..bcd2d81 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -260,14 +260,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
         err << "Unknown extension \"" << ext << "\" for file\n"
             << "  " << *si << "\n"
             << "try_compile() works only for enabled languages.  "
-            << "Currently these are:\n ";
+            << "Currently these are:\n  ";
         std::vector<std::string> langs;
         gg->GetEnabledLanguages(langs);
-        for(std::vector<std::string>::iterator l = langs.begin();
-            l != langs.end(); ++l)
-          {
-          err << " " << *l;
-          }
+        err << cmJoin(langs, " ");
         err << "\nSee project() command to enable other languages.";
         this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
         return -1;
@@ -373,12 +369,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     // handle any compile flags we need to pass on
     if (!compileDefs.empty())
       {
-      fprintf(fout, "add_definitions( ");
-      for (size_t i = 0; i < compileDefs.size(); ++i)
-        {
-        fprintf(fout,"%s ",compileDefs[i].c_str());
-        }
-      fprintf(fout, ")\n");
+      fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str());
       }
 
     /* Use a random file name to avoid rapid creation and deletion
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 6e55533..fd3aa0b 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -350,19 +350,10 @@ void cmFindBase::PrintFindStuff()
   std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n";
   std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n";
   std::cerr << "CMakePathName " << this->CMakePathName << "\n";
-  std::cerr << "Names  ";
-  for(unsigned int i =0; i < this->Names.size(); ++i)
-    {
-    std::cerr << this->Names[i] << " ";
-    }
-  std::cerr << "\n";
+  std::cerr << "Names  " << cmJoin(this->Names, " ") << "\n";
   std::cerr << "\n";
   std::cerr << "SearchPathSuffixes  ";
-  for(unsigned int i =0; i < this->SearchPathSuffixes.size(); ++i)
-    {
-    std::cerr << this->SearchPathSuffixes[i] << "\n";
-    }
-  std::cerr << "\n";
+  std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n";
   std::cerr << "SearchPaths\n";
   for(std::vector<std::string>::const_iterator i = this->SearchPaths.begin();
       i != this->SearchPaths.end(); ++i)
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c275e6b..a7cfda7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1330,13 +1330,7 @@ cmLocalUnixMakefileGenerator3
                       this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     fout << "\n"
          << "# Per-language clean rules from dependency scanning.\n"
-         << "foreach(lang";
-    for(std::set<std::string>::const_iterator l = languages.begin();
-        l != languages.end(); ++l)
-      {
-      fout << " " << *l;
-      }
-    fout << ")\n"
+         << "foreach(lang" << cmJoin(languages, " ") << ")\n"
          << "  include(" << this->GetTargetDirectory(target)
          << "/cmake_clean_${lang}.cmake OPTIONAL)\n"
          << "endforeach()\n";
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6a7dc6e..81582f5 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1329,12 +1329,7 @@ bool cmcmd::RunCommand(const char* comment,
   if(verbose)
     {
     std::cout << comment << ":\n";
-    for(std::vector<std::string>::iterator i = command.begin();
-        i != command.end(); ++i)
-      {
-      std::cout << *i << " ";
-      }
-    std::cout << "\n";
+    std::cout << cmJoin(command, " ") << "\n";
     }
   std::string output;
   int retCode =0;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41488e6aa5161adbcf50597842d2dc43ae186792
commit 41488e6aa5161adbcf50597842d2dc43ae186792
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Feb 9 19:50:09 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmCacheManager: Replace loop with algorithm.

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 45e92ce..0c77891 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -186,11 +186,7 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path)
   cmsys::Glob globIt;
   globIt.FindFiles(glob);
   std::vector<std::string> files = globIt.GetFiles();
-  for(std::vector<std::string>::iterator i = files.begin();
-      i != files.end(); ++i)
-    {
-    cmSystemTools::RemoveFile(*i);
-    }
+  std::for_each(files.begin(), files.end(), cmSystemTools::RemoveFile);
 }
 
 bool cmCacheManager::LoadCache(const std::string& path,

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0cf5953ef267c2713b41ce878343c9be643ced0a
commit 0cf5953ef267c2713b41ce878343c9be643ced0a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 12 22:29:11 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmGlobalGenerator: Replace loop with algorithm.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index c976c69..ac4489a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2571,17 +2571,12 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
     "test", "RUN_TESTS",
     "package", "PACKAGE",
     "package_source",
-    "ZERO_CHECK",
-    0
+    "ZERO_CHECK"
   };
 
-  for(const char** reservedTarget = reservedTargets;
-    *reservedTarget; ++reservedTarget)
-    {
-    if(name == *reservedTarget) return true;
-    }
-
-  return false;
+  return std::find(cmArrayBegin(reservedTargets),
+                   cmArrayEnd(reservedTargets), name)
+      != cmArrayEnd(reservedTargets);
 }
 
 void cmGlobalGenerator::SetExternalMakefileProjectGenerator(

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10c2ddfabf9168555c8b417d00daaa138df479f2
commit 10c2ddfabf9168555c8b417d00daaa138df479f2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Feb 15 13:40:56 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmTarget: Port loop to algorithm.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1ad0d48..7673554 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1542,12 +1542,8 @@ void cmTarget::DeleteDependencyForVS6( DependencyMap& depMap,
   if( map_itr != depMap.end() )
     {
     DependencyList& depList = map_itr->second;
-    DependencyList::iterator itr;
-    while( (itr = std::find(depList.begin(), depList.end(), dep)) !=
-           depList.end() )
-      {
-      depList.erase( itr );
-      }
+    depList.erase(std::remove(depList.begin(), depList.end(), dep),
+                  depList.end());
     }
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0906b1677a518037193145f40288bb996ba188f
commit d0906b1677a518037193145f40288bb996ba188f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 22:45:01 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1de4a59..c976c69 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2937,14 +2937,11 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
       {
       target->GetSourceFiles(sources, *ci);
       }
-    std::set<cmSourceFile*> emitted;
+    std::vector<cmSourceFile*>::const_iterator sourcesEnd
+        = cmRemoveDuplicates(sources);
     for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
-        si != sources.end(); ++si)
+        si != sourcesEnd; ++si)
       {
-      if (!emitted.insert(*si).second)
-        {
-        continue;
-        }
       Json::Value& lj_source = lj_sources.append(Json::objectValue);
       cmSourceFile* sf = *si;
       std::string const& sfp = sf->GetFullPath();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1dcc821fe84e59a37119fd204afde366e6984c0
commit f1dcc821fe84e59a37119fd204afde366e6984c0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 21:58:07 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmGeneratorTarget: Replace set insert algorithm with cmRemoveDuplicates.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a4f099b..44c9e9a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -528,23 +528,22 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs,
   std::vector<cmSourceFile const*> objectFiles;
   this->GetExternalObjects(objectFiles, config);
   std::vector<cmTarget*> objectLibraries;
-  std::set<cmTarget*> emitted;
   for(std::vector<cmSourceFile const*>::const_iterator
       it = objectFiles.begin(); it != objectFiles.end(); ++it)
     {
     std::string objLib = (*it)->GetObjectLibrary();
     if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib))
       {
-      if (emitted.insert(tgt).second)
-        {
-        objectLibraries.push_back(tgt);
-        }
+      objectLibraries.push_back(tgt);
       }
     }
 
+  std::vector<cmTarget*>::const_iterator end
+      = cmRemoveDuplicates(objectLibraries);
+
   for(std::vector<cmTarget*>::const_iterator
         ti = objectLibraries.begin();
-      ti != objectLibraries.end(); ++ti)
+      ti != end; ++ti)
     {
     cmTarget* objLib = *ti;
     cmGeneratorTarget* ogt =

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f3f372a9cff17d22e2ba0bd5fcf684e671d60e2
commit 8f3f372a9cff17d22e2ba0bd5fcf684e671d60e2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 12 23:45:25 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:58:00 2015 +0100

    cmLocalGenerator: Convert loop to algorithm.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6a6135b..3ad3d64 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2801,11 +2801,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
     if(this->WindowsShell)
       {
       std::string::size_type pos = 0;
-      while((pos = result.find('/', pos)) != std::string::npos)
-        {
-        result[pos] = '\\';
-        pos++;
-        }
+      std::replace(result.begin(), result.end(), '/', '\\');
       }
     result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f20a4257f2889387fcbf540b29b16f10843f2f9e
commit f20a4257f2889387fcbf540b29b16f10843f2f9e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 00:44:45 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:57:59 2015 +0100

    cmMakefile: Add flag to result and manipulate in place.
    
    Rather than creating a string, manipulating it, and then
    copying it to the result.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0d0c60a..6fd569e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1340,11 +1340,11 @@ void cmMakefile::AddDefineFlag(const char* flag)
 void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
 {
   // remove any \n\r
-  std::string ret = flag;
-  std::replace(ret.begin(), ret.end(), '\n', ' ');
-  std::replace(ret.begin(), ret.end(), '\r', ' ');
-  dflags += " ";
-  dflags += ret;
+  std::string::size_type initSize = dflags.size();
+  dflags += std::string(" ") + flag;
+  std::string::iterator flagStart = dflags.begin() + initSize + 1;
+  std::replace(flagStart, dflags.end(), '\n', ' ');
+  std::replace(flagStart, dflags.end(), '\r', ' ');
 }
 
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee269f4f16300b0427c1e1baef94b85ccc4ea13f
commit ee269f4f16300b0427c1e1baef94b85ccc4ea13f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 18 00:40:54 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:45:19 2015 +0100

    cmMakefile: Replace two loops with std::replace.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2085a97..0d0c60a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1341,19 +1341,8 @@ void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
 {
   // remove any \n\r
   std::string ret = flag;
-  std::string::size_type pos = 0;
-  while((pos = ret.find('\n', pos)) != std::string::npos)
-    {
-    ret[pos] = ' ';
-    pos++;
-    }
-  pos = 0;
-  while((pos = ret.find('\r', pos)) != std::string::npos)
-    {
-    ret[pos] = ' ';
-    pos++;
-    }
-
+  std::replace(ret.begin(), ret.end(), '\n', ' ');
+  std::replace(ret.begin(), ret.end(), '\r', ' ');
   dflags += " ";
   dflags += ret;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=470cff497bc26d48ee05de0b260af2546bb7698c
commit 470cff497bc26d48ee05de0b260af2546bb7698c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jan 27 22:39:46 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 23:45:18 2015 +0100

    cmMakefile: Replace loop with composed algorithm.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ac5fec9..2085a97 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1472,18 +1472,11 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
       cmSystemTools::ExpandListArgument(cdefs, defs);
 
       // Recompose the list without the definition.
-      std::string ndefs;
-      const char* sep = "";
-      for(std::vector<std::string>::const_iterator di = defs.begin();
-          di != defs.end(); ++di)
-        {
-        if(*di != define)
-          {
-          ndefs += sep;
-          sep = ";";
-          ndefs += *di;
-          }
-        }
+      std::vector<std::string>::const_iterator defEnd =
+          std::remove(defs.begin(), defs.end(), define);
+      std::vector<std::string>::const_iterator defBegin =
+          defs.begin();
+      std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";");
 
       // Store the new list.
       this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str());

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6ca1b82744154fa048634abdc353e4118a11979
commit e6ca1b82744154fa048634abdc353e4118a11979
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 12 20:47:53 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 18 21:36:35 2015 +0100

    cmCTest: Convert loop to member insert.

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f08b87c..69573ac 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2256,10 +2256,9 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
   bool SRArgumentSpecified = false;
 
   // copy the command line
-  for(size_t i=0; i < args.size(); ++i)
-    {
-    this->InitialCommandLineArguments.push_back(args[i]);
-    }
+  this->InitialCommandLineArguments.insert(
+      this->InitialCommandLineArguments.end(),
+      args.begin(), args.end());
 
   // process the command line arguments
   for(size_t i=1; i < args.size(); ++i)

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

Summary of changes:
 Source/cmAlgorithms.h                              |   11 +++++
 Source/cmCTest.cxx                                 |    7 ++-
 Source/cmCacheManager.cxx                          |    6 +--
 Source/cmComputeLinkDepends.cxx                    |    5 +-
 Source/cmCoreTryCompile.cxx                        |   23 +++-------
 Source/cmFindBase.cxx                              |   19 ++------
 Source/cmFindPackageCommand.cxx                    |   14 ++----
 Source/cmGeneratorTarget.cxx                       |   11 ++---
 Source/cmGlobalGenerator.cxx                       |   48 ++++++++++----------
 Source/cmLocalGenerator.cxx                        |    6 +--
 Source/cmLocalUnixMakefileGenerator3.cxx           |   15 +-----
 Source/cmMakefile.cxx                              |   46 +++++--------------
 Source/cmSystemTools.cxx                           |    2 +-
 Source/cmTarget.cxx                                |    8 +---
 Source/cmcmd.cxx                                   |   28 ++----------
 .../File_Generate/CommandConflict-stderr.txt       |    2 +-
 16 files changed, 79 insertions(+), 172 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list