[Cmake-commits] CMake branch, next, updated. v3.1.2-1276-g84c6acb

Stephen Kelly steveire at gmail.com
Wed Feb 11 14:57:12 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  84c6acb615a1fc48c43f75241c1de74a337b8d07 (commit)
       via  da4078d8654177c683d3f0544bdde8490537030c (commit)
       via  4e90e19bd10d2bd34a6b104f74a3d1ca9b445a42 (commit)
       via  466ced075eee8a6721a4f4f9dfb56727ce0cc9f7 (commit)
       via  accda6b07f29c024b8e1eef73bd19e083603aa35 (commit)
       via  c8918eaf1e8195bd47570812058f7f69820ae9bc (commit)
       via  8675d8471fa57a1415c360ab318e667e8dc6e6fb (commit)
       via  e72feb19253ed3fc8fe3d119582a0ff81044bbdf (commit)
       via  2db97910e89be78c7d51e3d8d46889c6679f48b4 (commit)
       via  26c69d686bcce330d4ba4a426e886c77df753cdf (commit)
       via  18de4e9895335b894a1b176ce8210e7521e1c92c (commit)
       via  b6b7b9ade08ad6d1d56c4463444accebd33bec91 (commit)
       via  709e96f11e0939638316bb3eab1e0bf32d5bdc05 (commit)
       via  255d307cd0cdecd0d10fabc020fd0b5b985c1eaf (commit)
      from  06b19bbb3777430b3348a082d57da56f0d6e0e34 (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=84c6acb615a1fc48c43f75241c1de74a337b8d07
commit 84c6acb615a1fc48c43f75241c1de74a337b8d07
Merge: 06b19bb da4078d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 14:57:10 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 11 14:57:10 2015 -0500

    Merge topic 'clean-up-cmMacroCommand' into next
    
    da4078d8 cmMacroCommand: Remove condition around ARGV replacement.
    4e90e19b cmMacroCommand: Move computation of ARGV%n names out of double loop.
    466ced07 cmMacroCommand: Move ARGV replacement out of condition.
    accda6b0 cmMacroCommand: Remove condition around ARGN replacement.
    c8918eaf cmMacroCommand: Declare tmps in the scope that it's used.
    8675d847 cmMacroCommand: Declare arg in the scope that it is used.
    e72feb19 cmMacroCommand: Inline variable computation.
    2db97910 cmMacroCommand: Compute variables outside of two loops.
    26c69d68 cmMacroCommand: Remove intermediate arg variables.
    18de4e98 cmMacroCommand: Remove condition around ARGN computation.
    b6b7b9ad cmMacroCommand: Remove conditional append of semicolon.
    709e96f1 cmMacroCommand: Declare arg variables where used and initialized.
    255d307c cmMacroCommand: Join the args strings outside of the loops.


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

    cmMacroCommand: Remove condition around ARGV replacement.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index c6f0571..1bc63a7 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -172,13 +172,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
 
         // if the current argument of the current function has ${ARGV in it
         // then try replacing ARGV values
-        if (tmps.find("${ARGV") != std::string::npos)
+        for (unsigned int t = 0; t < expandedArgs.size(); ++t)
           {
-          for (unsigned int t = 0; t < expandedArgs.size(); ++t)
-            {
-            cmSystemTools::ReplaceString(tmps, argVs[t].c_str(),
-                                         expandedArgs[t].c_str());
-            }
+          cmSystemTools::ReplaceString(tmps, argVs[t].c_str(),
+                                       expandedArgs[t].c_str());
           }
 
         arg.Value = tmps;

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

    cmMacroCommand: Move computation of ARGV%n names out of double loop.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index f797da8..c6f0571 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -113,10 +113,18 @@ bool cmMacroHelperCommand::InvokeInitialPass
   std::string expandedArgv = cmJoin(expandedArgs, ";");
   std::vector<std::string> variables;
   variables.reserve(this->Args.size() - 1);
+  std::vector<std::string> argVs;
+  argVs.reserve(this->Args.size() - 1);
+  char argvName[60];
   for (unsigned int j = 1; j < this->Args.size(); ++j)
     {
     variables.push_back("${" + this->Args[j] + "}");
     }
+  for (unsigned int j = 0; j < expandedArgs.size(); ++j)
+    {
+    sprintf(argvName,"${ARGV%i}",j);
+    argVs.push_back(argvName);
+    }
   if(!this->Functions.empty())
     {
     this->FilePath = this->Functions[0].FilePath;
@@ -166,12 +174,9 @@ bool cmMacroHelperCommand::InvokeInitialPass
         // then try replacing ARGV values
         if (tmps.find("${ARGV") != std::string::npos)
           {
-          char argvName[60];
-          // also replace the ARGV1 ARGV2 ... etc
           for (unsigned int t = 0; t < expandedArgs.size(); ++t)
             {
-            sprintf(argvName,"${ARGV%i}",t);
-            cmSystemTools::ReplaceString(tmps, argvName,
+            cmSystemTools::ReplaceString(tmps, argVs[t].c_str(),
                                          expandedArgs[t].c_str());
             }
           }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=466ced075eee8a6721a4f4f9dfb56727ce0cc9f7
commit 466ced075eee8a6721a4f4f9dfb56727ce0cc9f7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 20:08:05 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:54 2015 +0100

    cmMacroCommand: Move ARGV replacement out of condition.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index a9049bf..f797da8 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -160,14 +160,13 @@ bool cmMacroHelperCommand::InvokeInitialPass
         cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
 
         cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str());
+        cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str());
 
         // if the current argument of the current function has ${ARGV in it
         // then try replacing ARGV values
         if (tmps.find("${ARGV") != std::string::npos)
           {
           char argvName[60];
-          cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str());
-
           // also replace the ARGV1 ARGV2 ... etc
           for (unsigned int t = 0; t < expandedArgs.size(); ++t)
             {

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

    cmMacroCommand: Remove condition around ARGN replacement.
    
    There is none for ARGC replacement, so no reason to conditionalize the
    replacement.  The computation is already done.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 817681d..a9049bf 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -159,11 +159,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         // replace argc
         cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
 
-        // repleace ARGN
-        if (tmps.find("${ARGN}") != std::string::npos)
-          {
-          cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str());
-          }
+        cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str());
 
         // if the current argument of the current function has ${ARGV in it
         // then try replacing ARGV values

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

    cmMacroCommand: Declare tmps in the scope that it's used.
    
    We don't particularly need to reuse the string memory here, and this
    pattern is not common in CMake.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 2a1fea4..817681d 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -84,8 +84,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
   std::vector<std::string> expandedArgs;
   this->Makefile->ExpandArguments(args, expandedArgs);
 
-  std::string tmps;
-
   // make sure the number of arguments passed is at least the number
   // required by the signature
   if (expandedArgs.size() < this->Args.size() - 1)
@@ -151,7 +149,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         }
       else
         {
-        tmps = k->Value;
+        std::string tmps = k->Value;
         // replace formal arguments
         for (unsigned int j = 0; j < variables.size(); ++j)
           {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8675d8471fa57a1415c360ab318e667e8dc6e6fb
commit 8675d8471fa57a1415c360ab318e667e8dc6e6fb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 20:23:36 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:54 2015 +0100

    cmMacroCommand: Declare arg in the scope that it is used.
    
    It can make sense to declare objects outside of loops if
    the size required by the object can grow (eg std::string when
    using getline), but that is not the case here.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index b87b39f..2a1fea4 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -85,7 +85,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
   this->Makefile->ExpandArguments(args, expandedArgs);
 
   std::string tmps;
-  cmListFileArgument arg;
 
   // make sure the number of arguments passed is at least the number
   // required by the signature
@@ -144,6 +143,8 @@ bool cmMacroHelperCommand::InvokeInitialPass
       // Set the FilePath on the arguments to match the function since it is
       // not stored and the original values may be freed
       k->FilePath = this->FilePath.c_str();
+
+      cmListFileArgument arg;
       if(k->Delim == cmListFileArgument::Bracket)
         {
         arg.Value = k->Value;

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

    cmMacroCommand: Inline variable computation.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index ebf8b25..b87b39f 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -86,7 +86,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
 
   std::string tmps;
   cmListFileArgument arg;
-  std::string variable;
 
   // make sure the number of arguments passed is at least the number
   // required by the signature
@@ -119,10 +118,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
   variables.reserve(this->Args.size() - 1);
   for (unsigned int j = 1; j < this->Args.size(); ++j)
     {
-    std::string variable = "${";
-    variable += this->Args[j];
-    variable += "}";
-    variables.push_back(variable);
+    variables.push_back("${" + this->Args[j] + "}");
     }
   if(!this->Functions.empty())
     {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2db97910e89be78c7d51e3d8d46889c6679f48b4
commit 2db97910e89be78c7d51e3d8d46889c6679f48b4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 19:51:15 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:54 2015 +0100

    cmMacroCommand: Compute variables outside of two loops.
    
    Avoid computing them from scratch for each argument of each
    function.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 3a2afc1..ebf8b25 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -115,6 +115,15 @@ bool cmMacroHelperCommand::InvokeInitialPass
       = expandedArgs.begin() + this->Args.size() - 1;
   std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
   std::string expandedArgv = cmJoin(expandedArgs, ";");
+  std::vector<std::string> variables;
+  variables.reserve(this->Args.size() - 1);
+  for (unsigned int j = 1; j < this->Args.size(); ++j)
+    {
+    std::string variable = "${";
+    variable += this->Args[j];
+    variable += "}";
+    variables.push_back(variable);
+    }
   if(!this->Functions.empty())
     {
     this->FilePath = this->Functions[0].FilePath;
@@ -147,13 +156,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
         {
         tmps = k->Value;
         // replace formal arguments
-        for (unsigned int j = 1; j < this->Args.size(); ++j)
+        for (unsigned int j = 0; j < variables.size(); ++j)
           {
-          variable = "${";
-          variable += this->Args[j];
-          variable += "}";
-          cmSystemTools::ReplaceString(tmps, variable.c_str(),
-                                       expandedArgs[j-1].c_str());
+          cmSystemTools::ReplaceString(tmps, variables[j].c_str(),
+                                       expandedArgs[j].c_str());
           }
         // replace argc
         cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26c69d686bcce330d4ba4a426e886c77df753cdf
commit 26c69d686bcce330d4ba4a426e886c77df753cdf
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 19:26:33 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:54 2015 +0100

    cmMacroCommand: Remove intermediate arg variables.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index da5663d..3a2afc1 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -161,9 +161,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         // repleace ARGN
         if (tmps.find("${ARGN}") != std::string::npos)
           {
-          std::string argnDef;
-          argnDef += expandedArgn;
-          cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
+          cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str());
           }
 
         // if the current argument of the current function has ${ARGV in it
@@ -171,10 +169,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         if (tmps.find("${ARGV") != std::string::npos)
           {
           char argvName[60];
-
-          std::string argvDef;
-          argvDef += expandedArgv;
-          cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
+          cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str());
 
           // also replace the ARGV1 ARGV2 ... etc
           for (unsigned int t = 0; t < expandedArgs.size(); ++t)

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

    cmMacroCommand: Remove condition around ARGN computation.
    
    An empty string is appended if the condition is false, which is
    ok for this commit.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 597f63b..da5663d 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -162,10 +162,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         if (tmps.find("${ARGN}") != std::string::npos)
           {
           std::string argnDef;
-          if (expandedArgs.size() > this->Args.size() - 1)
-            {
-            argnDef += expandedArgn;
-            }
+          argnDef += expandedArgn;
           cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
           }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6b7b9ade08ad6d1d56c4463444accebd33bec91
commit b6b7b9ade08ad6d1d56c4463444accebd33bec91
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 19:16:15 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:54 2015 +0100

    cmMacroCommand: Remove conditional append of semicolon.
    
    The conditions are never true.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 367e4d3..597f63b 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -164,10 +164,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
           std::string argnDef;
           if (expandedArgs.size() > this->Args.size() - 1)
             {
-            if (!argnDef.empty() && !expandedArgs.empty())
-              {
-              argnDef += ";";
-              }
             argnDef += expandedArgn;
             }
           cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
@@ -180,10 +176,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
           char argvName[60];
 
           std::string argvDef;
-          if (!argvDef.empty() && !expandedArgs.empty())
-            {
-            argvDef += ";";
-            }
           argvDef += expandedArgv;
           cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
 

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

    cmMacroCommand: Declare arg variables where used and initialized.
    
    Make the initialization by population with the expanded* content
    unconditional.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 18d637a..367e4d3 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -111,15 +111,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
   argcDefStream << expandedArgs.size();
   std::string argcDef = argcDefStream.str();
 
-  // declare varuiables for ARGV ARGN but do not compute until needed
-  std::string argvDef;
-  std::string argnDef;
   std::vector<std::string>::const_iterator eit
       = expandedArgs.begin() + this->Args.size() - 1;
   std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
   std::string expandedArgv = cmJoin(expandedArgs, ";");
-  bool argnDefInitialized = false;
-  bool argvDefInitialized = false;
   if(!this->Functions.empty())
     {
     this->FilePath = this->Functions[0].FilePath;
@@ -166,17 +161,14 @@ bool cmMacroHelperCommand::InvokeInitialPass
         // repleace ARGN
         if (tmps.find("${ARGN}") != std::string::npos)
           {
-          if (!argnDefInitialized)
+          std::string argnDef;
+          if (expandedArgs.size() > this->Args.size() - 1)
             {
-            if (expandedArgs.size() > this->Args.size() - 1)
+            if (!argnDef.empty() && !expandedArgs.empty())
               {
-              if (!argnDef.empty() && !expandedArgs.empty())
-                {
-                argnDef += ";";
-                }
-              argnDef += expandedArgn;
+              argnDef += ";";
               }
-            argnDefInitialized = true;
+            argnDef += expandedArgn;
             }
           cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
           }
@@ -187,16 +179,12 @@ bool cmMacroHelperCommand::InvokeInitialPass
           {
           char argvName[60];
 
-          // repleace ARGV, compute it only once
-          if (!argvDefInitialized)
+          std::string argvDef;
+          if (!argvDef.empty() && !expandedArgs.empty())
             {
-            if (!argvDef.empty() && !expandedArgs.empty())
-              {
-              argvDef += ";";
-              }
-            argvDef += expandedArgv;
-            argvDefInitialized = true;
+            argvDef += ";";
             }
+          argvDef += expandedArgv;
           cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
 
           // also replace the ARGV1 ARGV2 ... etc

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=255d307cd0cdecd0d10fabc020fd0b5b985c1eaf
commit 255d307cd0cdecd0d10fabc020fd0b5b985c1eaf
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 11 20:47:16 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 11 20:51:53 2015 +0100

    cmMacroCommand: Join the args strings outside of the loops.
    
    This means that we compute the strings even if not used in the macro
    but this shouldn't be expensive and it simplifies the code.

diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e09a934..18d637a 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -114,6 +114,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
   // declare varuiables for ARGV ARGN but do not compute until needed
   std::string argvDef;
   std::string argnDef;
+  std::vector<std::string>::const_iterator eit
+      = expandedArgs.begin() + this->Args.size() - 1;
+  std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
+  std::string expandedArgv = cmJoin(expandedArgs, ";");
   bool argnDefInitialized = false;
   bool argvDefInitialized = false;
   if(!this->Functions.empty())
@@ -170,9 +174,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
                 {
                 argnDef += ";";
                 }
-              std::vector<std::string>::const_iterator eit
-                  = expandedArgs.begin() + this->Args.size() - 1;
-              argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";");
+              argnDef += expandedArgn;
               }
             argnDefInitialized = true;
             }
@@ -192,7 +194,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
               {
               argvDef += ";";
               }
-            argvDef += cmJoin(expandedArgs, ";");
+            argvDef += expandedArgv;
             argvDefInitialized = true;
             }
           cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());

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

Summary of changes:
 Source/cmMacroCommand.cxx |   86 +++++++++++++++------------------------------
 1 file changed, 29 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list