[Cmake-commits] CMake branch, next, updated. v3.1.2-1262-g06b19bb

Stephen Kelly steveire at gmail.com
Wed Feb 11 14:51:38 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  06b19bbb3777430b3348a082d57da56f0d6e0e34 (commit)
       via  60ebc7d79f98c44fee7d3b9011808278284eaade (commit)
       via  6def2609ecf259c34b5d4fcac1f0702e648a7d61 (commit)
       via  3f1cb2c0712e4e87b092643db981339033558a1b (commit)
       via  40c13235fca82b96a1d6ee7ac6b7bb4d6020562a (commit)
       via  a6a7e14a9242e7eb8bd0828aeeff39fd0f9794cd (commit)
       via  a505a05562e50fdf8251e5fdbf2d32383f6b47aa (commit)
       via  59345fec63e59eda6c9ffd257ace7b15d4ebfb97 (commit)
       via  28ec965e9cb5fd997c611081a1add1c410e35916 (commit)
       via  437febee725af25a028e786571120d073933c763 (commit)
       via  4d6ba5ceb73a61aafd0a47da70c02c65daac1c2d (commit)
       via  892c822a209097b23150a031a76e477cfcd6b067 (commit)
       via  6650bcdcb1c99550983a1b8e8d25e8e62735f9b0 (commit)
       via  e8c13de3780cc6ec4c213ca2c01d90aa3ebd543b (commit)
       via  af289a56b78fe0d584cd97cb01c7e8d6f90ed91b (commit)
       via  9e784682ada6badec5b4da09d6e05594774801f9 (commit)
       via  6a4efb0ebd87bcb66a3bf98246aef491c82fa6c7 (commit)
       via  11ecc31d0a2da0090195a682364fb4628f55673a (commit)
       via  f95543f8a6b38bf6d5350169bdb53d5066839b76 (commit)
       via  9fe8f49353f927882af256c7870eb24e4be0c9be (commit)
      from  8a2444385c68619836ed4e73a1175517b67d17c1 (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=06b19bbb3777430b3348a082d57da56f0d6e0e34
commit 06b19bbb3777430b3348a082d57da56f0d6e0e34
Merge: 8a24443 60ebc7d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 14:51:35 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 11 14:51:35 2015 -0500

    Merge topic 'use-cmRange' into next
    
    60ebc7d7 Convert loop into two algorithms.
    6def2609 Convert loop to the common pattern.
    3f1cb2c0 Move loop inside of condition.
    40c13235 Handle last element outside of the loop.
    a6a7e14a cmTarget: Use a sorted vector in place of a set.
    a505a055 cmSet: Replace loop with cmJoin.
    59345fec cmFindBase: Replace loop with cmJoin on range.
    28ec965e Convert loops to cmJoin algorithm with cmRange.
    437febee cmStringCommand: Accumulate with cmJoin and range adaptors.
    4d6ba5ce cmAlgorithms: Add a range adaptor and API for adjusting a range.
    892c822a Use cmJoin to accumulate string ranges.
    6650bcdc cmAlgorithms: Add a Range container and adaptor method.
    e8c13de3 Replace common loop pattern with cmJoin
    af289a56 Convert loops populating maybe-empty content into the common pattern.
    9e784682 Convert loops into the commonly used pattern.
    6a4efb0e cmMacroCommand: Remove counting variable.
    ...


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60ebc7d79f98c44fee7d3b9011808278284eaade
commit 60ebc7d79f98c44fee7d3b9011808278284eaade
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 24 18:07:37 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    Convert loop into two algorithms.

diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 359141a..a08c159 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2299,16 +2299,12 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
       {
       // Now add the rest of the components separated by the proper slash
       // direction for this platform.
-      const char* sep = "";
-      for(unsigned int i=1; i < components.size() - 1; ++i)
-        {
-        if(!components[i].empty())
-          {
-          result += sep;
-          result += components[i];
-          sep = slash;
-          }
-        }
+      std::vector<std::string>::const_iterator compEnd
+          = std::remove(components.begin() + 1, components.end() - 1,
+                          std::string());
+      std::vector<std::string>::const_iterator compStart
+          = components.begin() + 1;
+      result += cmJoin(cmRange(compStart, compEnd), slash);
       // Only the last component can be empty to avoid double slashes.
       result += slash;
       result += components.back();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6def2609ecf259c34b5d4fcac1f0702e648a7d61
commit 6def2609ecf259c34b5d4fcac1f0702e648a7d61
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 23 01:06:40 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    Convert loop to the common pattern.

diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 703ab27..359141a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2299,24 +2299,18 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
       {
       // Now add the rest of the components separated by the proper slash
       // direction for this platform.
-      bool first = true;
+      const char* sep = "";
       for(unsigned int i=1; i < components.size() - 1; ++i)
         {
         if(!components[i].empty())
           {
-          if(!first)
-            {
-            result += slash;
-            }
+          result += sep;
           result += components[i];
-          first = false;
+          sep = slash;
           }
         }
       // Only the last component can be empty to avoid double slashes.
-      if(!first)
-        {
-        result += slash;
-        }
+      result += slash;
       result += components.back();
       }
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f1cb2c0712e4e87b092643db981339033558a1b
commit 3f1cb2c0712e4e87b092643db981339033558a1b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 23:09:03 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    Move loop inside of condition.
    
    The loop is only executed if the condition is true.

diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 32da821..703ab27 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2295,23 +2295,23 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
     // Begin the quoted result with the root component.
     result += components[0];
 
-    // Now add the rest of the components separated by the proper slash
-    // direction for this platform.
-    bool first = true;
-    for(unsigned int i=1; i < components.size() - 1; ++i)
+    if (components.size() > 1)
       {
-      if(!components[i].empty())
+      // Now add the rest of the components separated by the proper slash
+      // direction for this platform.
+      bool first = true;
+      for(unsigned int i=1; i < components.size() - 1; ++i)
         {
-        if(!first)
+        if(!components[i].empty())
           {
-          result += slash;
+          if(!first)
+            {
+            result += slash;
+            }
+          result += components[i];
+          first = false;
           }
-        result += components[i];
-        first = false;
         }
-      }
-    if (components.size() > 1)
-      {
       // Only the last component can be empty to avoid double slashes.
       if(!first)
         {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40c13235fca82b96a1d6ee7ac6b7bb4d6020562a
commit 40c13235fca82b96a1d6ee7ac6b7bb4d6020562a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 23 01:03:45 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    Handle last element outside of the loop.
    
    There is no point in checking on each loop iteration whether
    it is the last element.

diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 54d330f..32da821 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2298,10 +2298,9 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
     // Now add the rest of the components separated by the proper slash
     // direction for this platform.
     bool first = true;
-    for(unsigned int i=1; i < components.size(); ++i)
+    for(unsigned int i=1; i < components.size() - 1; ++i)
       {
-      // Only the last component can be empty to avoid double slashes.
-      if(!components[i].empty() || (i == (components.size()-1)))
+      if(!components[i].empty())
         {
         if(!first)
           {
@@ -2311,6 +2310,15 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
         first = false;
         }
       }
+    if (components.size() > 1)
+      {
+      // Only the last component can be empty to avoid double slashes.
+      if(!first)
+        {
+        result += slash;
+        }
+      result += components.back();
+      }
     }
 
   // Close the quoted result.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6a7e14a9242e7eb8bd0828aeeff39fd0f9794cd
commit a6a7e14a9242e7eb8bd0828aeeff39fd0f9794cd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 22:48:02 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    cmTarget: Use a sorted vector in place of a set.
    
    The vector has a more easy-to-use API.
    
    Join the string with cmJoin, and avoid erasing from the container
    in the loop.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f0bdea7..526a923 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6687,40 +6687,33 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
 
   if (!prop.empty())
     {
-    // Use a std::set to keep the error message sorted.
-    std::set<std::string> props;
+    // Use a sorted std::vector to keep the error message sorted.
+    std::vector<std::string> props;
     std::set<std::string>::const_iterator i = emittedBools.find(prop);
     if (i != emittedBools.end())
       {
-      props.insert(strBool);
+      props.push_back(strBool);
       }
     i = emittedStrings.find(prop);
     if (i != emittedStrings.end())
       {
-      props.insert(strString);
+      props.push_back(strString);
       }
     i = emittedMinNumbers.find(prop);
     if (i != emittedMinNumbers.end())
       {
-      props.insert(strNumMin);
+      props.push_back(strNumMin);
       }
     i = emittedMaxNumbers.find(prop);
     if (i != emittedMaxNumbers.end())
       {
-      props.insert(strNumMax);
+      props.push_back(strNumMax);
       }
+    std::sort(props.begin(), props.end());
+
+    std::string propsString = cmJoin(cmRange(props).retreat(1), ", ");
+    propsString += " and the " + props.back();
 
-    std::string propsString = *props.begin();
-    props.erase(props.begin());
-    while (props.size() > 1)
-      {
-      propsString += ", " + *props.begin();
-      props.erase(props.begin());
-      }
-   if (props.size() == 1)
-     {
-     propsString += " and the " + *props.begin();
-     }
     std::ostringstream e;
     e << "Property \"" << prop << "\" appears in both the "
       << propsString <<

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a505a05562e50fdf8251e5fdbf2d32383f6b47aa
commit a505a05562e50fdf8251e5fdbf2d32383f6b47aa
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 23:26:58 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    cmSet: Replace loop with cmJoin.

diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 90d7b03..204d95b 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -108,17 +108,7 @@ bool cmSetCommand
     }
 
   // collect any values into a single semi-colon separated value list
-  if(static_cast<unsigned short>(args.size()) >
-     static_cast<unsigned short>(1 + ignoreLastArgs))
-    {
-    value = args[1];
-    size_t endPos = args.size() - ignoreLastArgs;
-    for(size_t i = 2; i < endPos; ++i)
-      {
-      value += ";";
-      value += args[i];
-      }
-    }
+  value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";");
 
   if (parentScope)
     {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59345fec63e59eda6c9ffd257ace7b15d4ebfb97
commit 59345fec63e59eda6c9ffd257ace7b15d4ebfb97
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jan 14 22:23:41 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:08 2015 +0100

    cmFindBase: Replace loop with cmJoin on range.

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 69991d5..6e55533 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -166,11 +166,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
       }
     else
       {
-      this->VariableDocumentation += "one of the " + this->Names[0];
-      for (unsigned int j = 1; j < this->Names.size() - 1; ++j)
-        {
-        this->VariableDocumentation += ", " + this->Names[j];
-        }
+      this->VariableDocumentation += "one of the ";
+      this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1),
+                                            ", ");
       this->VariableDocumentation += " or "
         + this->Names[this->Names.size() - 1] + " libraries be found";
       }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28ec965e9cb5fd997c611081a1add1c410e35916
commit 28ec965e9cb5fd997c611081a1add1c410e35916
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 25 15:53:20 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    Convert loops to cmJoin algorithm with cmRange.

diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 8d1657d..dd0cfa9 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -259,14 +259,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
     {
     listString += ";";
     }
-  const char* sep = "";
-  size_t cc;
-  for ( cc = 2; cc < args.size(); ++ cc )
-    {
-    listString += sep;
-    listString += args[cc];
-    sep = ";";
-    }
+  listString += cmJoin(cmRange(args).advance(2), ";");
 
   this->Makefile->AddDefinition(listName, listString.c_str());
   return true;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 05d8ab5..35956ad 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3016,13 +3016,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
     {
     relative += "/";
     }
-  const char* sep = "";
-  for(unsigned int i=common; i < remote.size(); ++i)
-    {
-    relative += sep;
-    relative += remote[i];
-    sep = "/";
-    }
+  relative += cmJoin(cmRange(remote).advance(common), "/");
 
   // Finally return the path.
   return relative;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 0ebaa50..e09a934 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -172,12 +172,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
                 }
               std::vector<std::string>::const_iterator eit
                   = expandedArgs.begin() + this->Args.size() - 1;
-              const char* sep = "";
-              for( ; eit != expandedArgs.end(); ++eit)
-                {
-                argnDef += sep + *eit;
-                sep = ";";
-                }
+              argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";");
               }
             argnDefInitialized = true;
             }
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 5260cb0..5c93975 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -406,12 +406,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     // Clock command
     else if (args[1] == "time" && args.size() > 2)
       {
-      std::string command = args[2];
-      for (std::string::size_type cc = 3; cc < args.size(); cc ++)
-        {
-        command += " ";
-        command += args[cc];
-        }
+      std::string command = cmJoin(cmRange(args).advance(2), " ");
 
       clock_t clock_start, clock_finish;
       time_t time_start, time_finish;
@@ -473,14 +468,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         }
 
       std::string command = "\"";
-      command += args[3];
+      command += cmJoin(cmRange(args).advance(3), "\" \"");
       command += "\"";
-      for (std::string::size_type cc = 4; cc < args.size(); cc ++)
-        {
-        command += " \"";
-        command += args[cc];
-        command += "\"";
-        }
       int retval = 0;
       int timeout = 0;
       if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=437febee725af25a028e786571120d073933c763
commit 437febee725af25a028e786571120d073933c763
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 22:23:41 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    cmStringCommand: Accumulate with cmJoin and range adaptors.

diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 3e606d7..edc6afc 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -303,13 +303,6 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
   std::string regex = args[2];
   std::string outvar = args[3];
 
-  // Concatenate all the last arguments together.
-  std::string input = args[4];
-  for(unsigned int i=5; i < args.size(); ++i)
-    {
-    input += args[i];
-    }
-
   this->Makefile->ClearMatches();
   // Compile the regular expression.
   cmsys::RegularExpression re;
@@ -321,6 +314,9 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
     return false;
     }
 
+  // Concatenate all the last arguments together.
+  std::string input = cmJoin(cmRange(args).advance(4), std::string());
+
   // Scan through the input for all matches.
   std::string output;
   if(re.find(input.c_str()))
@@ -352,13 +348,6 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
   std::string regex = args[2];
   std::string outvar = args[3];
 
-  // Concatenate all the last arguments together.
-  std::string input = args[4];
-  for(unsigned int i=5; i < args.size(); ++i)
-    {
-    input += args[i];
-    }
-
   this->Makefile->ClearMatches();
   // Compile the regular expression.
   cmsys::RegularExpression re;
@@ -371,6 +360,9 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
     return false;
     }
 
+  // Concatenate all the last arguments together.
+  std::string input = cmJoin(cmRange(args).advance(4), std::string());
+
   // Scan through the input for all matches.
   std::string output;
   const char* p = input.c_str();
@@ -456,13 +448,6 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
     l = r;
     }
 
-  // Concatenate all the last arguments together.
-  std::string input = args[5];
-  for(unsigned int i=6; i < args.size(); ++i)
-    {
-    input += args[i];
-    }
-
   this->Makefile->ClearMatches();
   // Compile the regular expression.
   cmsys::RegularExpression re;
@@ -475,6 +460,9 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
     return false;
     }
 
+  // Concatenate all the last arguments together.
+  std::string input = cmJoin(cmRange(args).advance(5), std::string());
+
   // Scan through the input for all matches.
   std::string output;
   std::string::size_type base = 0;
@@ -673,11 +661,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
   const std::string& replaceExpression = args[2];
   const std::string& variableName = args[3];
 
-  std::string input = args[4];
-  for(unsigned int i=5; i < args.size(); ++i)
-    {
-    input += args[i];
-    }
+  std::string input = cmJoin(cmRange(args).advance(4), std::string());
 
   cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
                                     replaceExpression.c_str());
@@ -756,11 +740,7 @@ bool cmStringCommand
     }
 
   std::string const& variableName = args[1];
-  std::string value;
-  for(unsigned int i = 2; i < args.size(); ++i)
-    {
-    value += args[i];
-    }
+  std::string value = cmJoin(cmRange(args).advance(2), std::string());
 
   this->Makefile->AddDefinition(variableName, value.c_str());
   return true;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d6ba5ceb73a61aafd0a47da70c02c65daac1c2d
commit 4d6ba5ceb73a61aafd0a47da70c02c65daac1c2d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 22:14:54 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    cmAlgorithms: Add a range adaptor and API for adjusting a range.

diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 6c03f51..ad2b9c1 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -122,6 +122,17 @@ struct Range
   const_iterator begin() const { return Begin; }
   const_iterator end() const { return End; }
   bool empty() const { return std::distance(Begin, End) == 0; }
+  Range& advance(cmIML_INT_intptr_t amount)
+  {
+    std::advance(Begin, amount);
+    return *this;
+  }
+
+  Range& retreat(cmIML_INT_intptr_t amount)
+  {
+    std::advance(End, -amount);
+    return *this;
+  }
 private:
   const_iterator Begin;
   const_iterator End;
@@ -135,6 +146,14 @@ ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end)
   return ContainerAlgorithms::Range<Iter1>(begin, end);
 }
 
+template<typename Range>
+ContainerAlgorithms::Range<typename Range::const_iterator>
+cmRange(Range const& range)
+{
+  return ContainerAlgorithms::Range<typename Range::const_iterator>(
+      range.begin(), range.end());
+}
+
 template<typename Container>
 void cmDeleteAll(Container const& c)
 {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=892c822a209097b23150a031a76e477cfcd6b067
commit 892c822a209097b23150a031a76e477cfcd6b067
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jan 14 21:27:25 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    Use cmJoin to accumulate string ranges.
    
    Avoid using the std::accumulate algorithm which is designed for
    numeric types, not complex types.  It introduces unneccessary
    copies.
    
    Initialize variables where they are populated.

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8b893bc..212603c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -217,7 +217,6 @@ bool cmFileCommand
 bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
   bool append)
 {
-  std::string message;
   std::vector<std::string>::const_iterator i = args.begin();
 
   i++; // Get rid of subcommand
@@ -231,10 +230,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
 
   i++;
 
-  for(;i != args.end(); ++i)
-    {
-    message += *i;
-    }
   if ( !this->Makefile->CanIWriteThisFile(fileName.c_str()) )
     {
     std::string e
@@ -272,6 +267,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
     this->SetError(error);
     return false;
     }
+  std::string message = cmJoin(cmRange(i, args.end()), std::string());
   file << message;
   file.close();
   if(mode)
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 88d6a77..0449c50 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -20,7 +20,6 @@ bool cmMessageCommand
     this->SetError("called with incorrect number of arguments");
     return false;
     }
-  std::string message;
   std::vector<std::string>::const_iterator i = args.begin();
 
   cmake::MessageType type = cmake::MESSAGE;
@@ -70,10 +69,7 @@ bool cmMessageCommand
     ++i;
     }
 
-  for(;i != args.end(); ++i)
-    {
-    message += *i;
-    }
+  std::string message = cmJoin(cmRange(i, args.end()), std::string());
 
   if (type != cmake::MESSAGE)
     {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6650bcdcb1c99550983a1b8e8d25e8e62735f9b0
commit 6650bcdcb1c99550983a1b8e8d25e8e62735f9b0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 10 22:19:21 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    cmAlgorithms: Add a Range container and adaptor method.
    
    This can make a pair of iterators API compatible with the
    cmJoin algorithm and other range-based algorithms.
    
    Accept different iterator types in the cmRange adaptor so that
    a const and non-const iterator are accepted.

diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 4938140..6c03f51 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -112,6 +112,27 @@ struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
   }
 };
 
+template<typename const_iterator_>
+struct Range
+{
+  typedef const_iterator_ const_iterator;
+  typedef typename std::iterator_traits<const_iterator>::value_type value_type;
+  Range(const_iterator begin_, const_iterator end_)
+    : Begin(begin_), End(end_) {}
+  const_iterator begin() const { return Begin; }
+  const_iterator end() const { return End; }
+  bool empty() const { return std::distance(Begin, End) == 0; }
+private:
+  const_iterator Begin;
+  const_iterator End;
+};
+
+}
+
+template<typename Iter1, typename Iter2>
+ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end)
+{
+  return ContainerAlgorithms::Range<Iter1>(begin, end);
 }
 
 template<typename Container>

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8c13de3780cc6ec4c213ca2c01d90aa3ebd543b
commit e8c13de3780cc6ec4c213ca2c01d90aa3ebd543b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jan 14 21:31:46 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:07 2015 +0100

    Replace common loop pattern with cmJoin

diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7746980..fd9b236 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1064,26 +1064,11 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
     }
 
 
-  std::string tmp;
-  const char* sep ="";
-  for(size_t i=0; i<foundContents.size(); i++)
-    {
-    tmp += sep;
-    tmp += foundContents[i];
-    sep = ";";
-    }
-
+  std::string tmp = cmJoin(foundContents, ";");
   this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND",
                                                   tmp.c_str());
 
-  tmp = "";
-  sep = "";
-  for(size_t i=0; i<notFoundContents.size(); i++)
-    {
-    tmp += sep;
-    tmp += notFoundContents[i];
-    sep = ";";
-    }
+  tmp = cmJoin(notFoundContents, ";");
   this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
                                                   tmp.c_str());
 }
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index c33048c..b44e228 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -193,12 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
     if (!this->Depth)
       {
       std::string name = this->Args[0];
-      std::vector<std::string>::size_type cc;
-      name += "(";
-      for ( cc = 0; cc < this->Args.size(); cc ++ )
-        {
-        name += " " + this->Args[cc];
-        }
+      name += "( ";
+      name += cmJoin(this->Args, " ");
       name += " )";
 
       // create a new command and add it to cmake
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index c0e4683..84c00ba 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -34,15 +34,7 @@ bool cmGetCMakePropertyCommand
     std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
     if (!vars.empty())
       {
-      output = "";
-      const char* sep = "";
-      std::vector<std::string>::size_type cc;
-      for ( cc = 0; cc < vars.size(); ++cc )
-        {
-        output += sep;
-        output += vars[cc];
-        sep = ";";
-        }
+      output = cmJoin(vars, ";");
       }
     }
   else if ( args[1] == "MACROS" )
@@ -54,15 +46,7 @@ bool cmGetCMakePropertyCommand
     const std::set<std::string>* components
       = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
         ->GetInstallComponents();
-    std::set<std::string>::const_iterator compIt;
-    output = "";
-    const char* sep = "";
-    for (compIt = components->begin(); compIt != components->end(); ++compIt)
-      {
-      output += sep;
-      output += *compIt;
-      sep = ";";
-      }
+    output = cmJoin(*components, ";");
     }
   else
     {
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e1de7c3..0ebaa50 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -197,14 +197,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
               {
               argvDef += ";";
               }
-            const char* sep = "";
-            std::vector<std::string>::const_iterator eit;
-            for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
-              {
-              argvDef += sep;
-              argvDef += *eit;
-              sep = ";";
-              }
+            argvDef += cmJoin(expandedArgs, ";");
             argvDefInitialized = true;
             }
           cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index aca4413..ac5fec9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4202,15 +4202,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     }
   else if (prop == "LISTFILE_STACK")
     {
-    const char* sep = "";
-    for (std::deque<std::string>::const_iterator
-        i = this->ListFileStack.begin();
-        i != this->ListFileStack.end(); ++i)
-      {
-      output += sep;
-      output += *i;
-      sep = ";";
-      }
+    output = cmJoin(this->ListFileStack, ";");
     return output.c_str();
     }
   else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
@@ -4220,14 +4212,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
       {
       cacheonly = 1;
       }
-    std::vector<std::string> vars = this->GetDefinitions(cacheonly);
-    const char* sep = "";
-    for (unsigned int cc = 0; cc < vars.size(); cc ++ )
-      {
-      output += sep;
-      output += vars[cc];
-      sep = ";";
-      }
+    output = cmJoin(this->GetDefinitions(cacheonly), ";");
     return output.c_str();
     }
   else if (prop == "MACROS")
@@ -4242,16 +4227,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     }
   else if (prop == "LINK_DIRECTORIES")
     {
-    const char* sep = "";
-    for (std::vector<std::string>::const_iterator
-         it = this->GetLinkDirectories().begin();
-         it != this->GetLinkDirectories().end();
-         ++ it )
-      {
-      output += sep;
-      output += *it;
-      sep = ";";
-      }
+    output = cmJoin(this->GetLinkDirectories(), ";");
     return output.c_str();
     }
   else if (prop == "INCLUDE_DIRECTORIES")
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index e505440..60728ea 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -34,11 +34,7 @@ bool cmOptionCommand
   if(argError)
     {
     std::string m = "called with incorrect number of arguments: ";
-    for(size_t i =0; i < args.size(); ++i)
-      {
-      m += args[i];
-      m += " ";
-      }
+    m += cmJoin(args, " ");
     this->SetError(m);
     return false;
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af289a56b78fe0d584cd97cb01c7e8d6f90ed91b
commit af289a56b78fe0d584cd97cb01c7e8d6f90ed91b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 17 17:36:19 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    Convert loops populating maybe-empty content into the common pattern.

diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 107dca9..8d1657d 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -254,14 +254,18 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
   // expand the variable
   std::string listString;
   this->GetListString(listString, listName);
+
+  if(!listString.empty() && !args.empty())
+    {
+    listString += ";";
+    }
+  const char* sep = "";
   size_t cc;
   for ( cc = 2; cc < args.size(); ++ cc )
     {
-    if(!listString.empty())
-      {
-      listString += ";";
-      }
+    listString += sep;
     listString += args[cc];
+    sep = ";";
     }
 
   this->Makefile->AddDefinition(listName, listString.c_str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7afe05f..05d8ab5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3011,13 +3011,17 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
   // trailing slash in the input then the last iteration of the loop
   // will add a slash followed by an empty string which will preserve
   // the trailing slash in the output.
+
+  if(!relative.empty() && !remote.empty())
+    {
+    relative += "/";
+    }
+  const char* sep = "";
   for(unsigned int i=common; i < remote.size(); ++i)
     {
-    if(!relative.empty())
-      {
-      relative += "/";
-      }
+    relative += sep;
     relative += remote[i];
+    sep = "/";
     }
 
   // Finally return the path.
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 36808e0..e1de7c3 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -166,15 +166,17 @@ bool cmMacroHelperCommand::InvokeInitialPass
             {
             if (expandedArgs.size() > this->Args.size() - 1)
               {
+              if (!argnDef.empty() && !expandedArgs.empty())
+                {
+                argnDef += ";";
+                }
               std::vector<std::string>::const_iterator eit
                   = expandedArgs.begin() + this->Args.size() - 1;
+              const char* sep = "";
               for( ; eit != expandedArgs.end(); ++eit)
                 {
-                if (!argnDef.empty())
-                  {
-                  argnDef += ";";
-                  }
-                argnDef += *eit;
+                argnDef += sep + *eit;
+                sep = ";";
                 }
               }
             argnDefInitialized = true;
@@ -191,14 +193,17 @@ bool cmMacroHelperCommand::InvokeInitialPass
           // repleace ARGV, compute it only once
           if (!argvDefInitialized)
             {
+            if (!argvDef.empty() && !expandedArgs.empty())
+              {
+              argvDef += ";";
+              }
+            const char* sep = "";
             std::vector<std::string>::const_iterator eit;
             for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
               {
-              if (!argvDef.empty())
-                {
-                argvDef += ";";
-                }
+              argvDef += sep;
               argvDef += *eit;
+              sep = ";";
               }
             argvDefInitialized = true;
             }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e784682ada6badec5b4da09d6e05594774801f9
commit 9e784682ada6badec5b4da09d6e05594774801f9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 17 17:47:10 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    Convert loops into the commonly used pattern.

diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index e193cf5..c0e4683 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -25,7 +25,6 @@ bool cmGetCMakePropertyCommand
     return false;
     }
 
-  std::vector<std::string>::size_type cc;
   std::string variable = args[0];
   std::string output = "NOTFOUND";
 
@@ -35,12 +34,15 @@ bool cmGetCMakePropertyCommand
     std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
     if (!vars.empty())
       {
-      output = vars[0];
-      }
-    for ( cc = 1; cc < vars.size(); ++cc )
-      {
-      output += ";";
-      output += vars[cc];
+      output = "";
+      const char* sep = "";
+      std::vector<std::string>::size_type cc;
+      for ( cc = 0; cc < vars.size(); ++cc )
+        {
+        output += sep;
+        output += vars[cc];
+        sep = ";";
+        }
       }
     }
   else if ( args[1] == "MACROS" )
@@ -54,13 +56,12 @@ bool cmGetCMakePropertyCommand
         ->GetInstallComponents();
     std::set<std::string>::const_iterator compIt;
     output = "";
+    const char* sep = "";
     for (compIt = components->begin(); compIt != components->end(); ++compIt)
       {
-      if (compIt != components->begin())
-        {
-        output += ";";
-        }
+      output += sep;
       output += *compIt;
+      sep = ";";
       }
     }
   else
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eb68e49..aca4413 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3752,15 +3752,12 @@ void cmMakefile::GetListOfMacros(std::string& macros) const
 {
   StringStringMap::const_iterator it;
   macros = "";
-  int cc = 0;
+  const char* sep = "";
   for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it )
     {
-    if ( cc > 0 )
-      {
-      macros += ";";
-      }
+    macros += sep;
     macros += it->first;
-    cc ++;
+    sep = "";
     }
 }
 
@@ -4205,15 +4202,14 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     }
   else if (prop == "LISTFILE_STACK")
     {
+    const char* sep = "";
     for (std::deque<std::string>::const_iterator
         i = this->ListFileStack.begin();
         i != this->ListFileStack.end(); ++i)
       {
-      if (i != this->ListFileStack.begin())
-        {
-        output += ";";
-        }
+      output += sep;
       output += *i;
+      sep = ";";
       }
     return output.c_str();
     }
@@ -4225,13 +4221,12 @@ const char *cmMakefile::GetProperty(const std::string& prop,
       cacheonly = 1;
       }
     std::vector<std::string> vars = this->GetDefinitions(cacheonly);
+    const char* sep = "";
     for (unsigned int cc = 0; cc < vars.size(); cc ++ )
       {
-      if ( cc > 0 )
-        {
-        output += ";";
-        }
+      output += sep;
       output += vars[cc];
+      sep = ";";
       }
     return output.c_str();
     }
@@ -4247,19 +4242,16 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     }
   else if (prop == "LINK_DIRECTORIES")
     {
-    std::ostringstream str;
+    const char* sep = "";
     for (std::vector<std::string>::const_iterator
          it = this->GetLinkDirectories().begin();
          it != this->GetLinkDirectories().end();
          ++ it )
       {
-      if ( it != this->GetLinkDirectories().begin())
-        {
-        str << ";";
-        }
-      str << it->c_str();
+      output += sep;
+      output += *it;
+      sep = ";";
       }
-    output = str.str();
     return output.c_str();
     }
   else if (prop == "INCLUDE_DIRECTORIES")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a4efb0ebd87bcb66a3bf98246aef491c82fa6c7
commit 6a4efb0ebd87bcb66a3bf98246aef491c82fa6c7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 25 15:47:21 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    cmMacroCommand: Remove counting variable.
    
    Start iteration at correct starting point directly.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index c1e7cbb..36808e0 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -167,19 +167,14 @@ bool cmMacroHelperCommand::InvokeInitialPass
             if (expandedArgs.size() > this->Args.size() - 1)
               {
               std::vector<std::string>::const_iterator eit
-                  = expandedArgs.begin();
-              std::vector<std::string>::size_type cnt = 0;
+                  = expandedArgs.begin() + this->Args.size() - 1;
               for( ; eit != expandedArgs.end(); ++eit)
                 {
-                if ( cnt >= this->Args.size()-1 )
+                if (!argnDef.empty())
                   {
-                  if (!argnDef.empty())
-                    {
-                    argnDef += ";";
-                    }
-                  argnDef += *eit;
+                  argnDef += ";";
                   }
-                cnt ++;
+                argnDef += *eit;
                 }
               }
             argnDefInitialized = true;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11ecc31d0a2da0090195a682364fb4628f55673a
commit 11ecc31d0a2da0090195a682364fb4628f55673a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 25 15:44:49 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    cmMacroCommand: Execute loop only if it has an effect.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index c1eb35e..c1e7cbb 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -164,20 +164,23 @@ bool cmMacroHelperCommand::InvokeInitialPass
           {
           if (!argnDefInitialized)
             {
-            std::vector<std::string>::const_iterator eit
-                = expandedArgs.begin();
-            std::vector<std::string>::size_type cnt = 0;
-            for( ; eit != expandedArgs.end(); ++eit)
+            if (expandedArgs.size() > this->Args.size() - 1)
               {
-              if ( cnt >= this->Args.size()-1 )
+              std::vector<std::string>::const_iterator eit
+                  = expandedArgs.begin();
+              std::vector<std::string>::size_type cnt = 0;
+              for( ; eit != expandedArgs.end(); ++eit)
                 {
-                if (!argnDef.empty())
+                if ( cnt >= this->Args.size()-1 )
                   {
-                  argnDef += ";";
+                  if (!argnDef.empty())
+                    {
+                    argnDef += ";";
+                    }
+                  argnDef += *eit;
                   }
-                argnDef += *eit;
+                cnt ++;
                 }
-              cnt ++;
               }
             argnDefInitialized = true;
             }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f95543f8a6b38bf6d5350169bdb53d5066839b76
commit f95543f8a6b38bf6d5350169bdb53d5066839b76
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 25 15:42:12 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    cmMacroCommand: Extract iteration starting point.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e7c6a29..c1eb35e 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -164,9 +164,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
           {
           if (!argnDefInitialized)
             {
-            std::vector<std::string>::const_iterator eit;
+            std::vector<std::string>::const_iterator eit
+                = expandedArgs.begin();
             std::vector<std::string>::size_type cnt = 0;
-            for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
+            for( ; eit != expandedArgs.end(); ++eit)
               {
               if ( cnt >= this->Args.size()-1 )
                 {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9fe8f49353f927882af256c7870eb24e4be0c9be
commit 9fe8f49353f927882af256c7870eb24e4be0c9be
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 00:29:20 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:06 2015 +0100

    cmMacroCommand: Replace a loop with cmJoin.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 69fcca7..e7c6a29 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -262,11 +262,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
     if (!this->Depth)
       {
       std::string name = this->Args[0];
-      std::vector<std::string>::size_type cc;
       name += "(";
-      for ( cc = 0; cc < this->Args.size(); cc ++ )
+      if (!this->Args.empty())
         {
-        name += " " + this->Args[cc];
+        name += " ";
+        name += cmJoin(this->Args, " ");
         }
       name += " )";
       mf.AddMacro(this->Args[0].c_str(), name.c_str());

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list