[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-897-g1b9bcaa

Brad King brad.king at kitware.com
Wed Nov 26 13:55:50 EST 2014


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  1b9bcaabe6e4a190a16271c61d0efa839b6072fd (commit)
       via  808c77e2319a4a81a86b2df3bf8fbba6bdbac7ac (commit)
       via  7d674b5f0b28a610333644d417c2e8cb796cc9e4 (commit)
      from  7c3857cb076e3250e364e9fe2fe46bca78be7eed (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=1b9bcaabe6e4a190a16271c61d0efa839b6072fd
commit 1b9bcaabe6e4a190a16271c61d0efa839b6072fd
Merge: 7c3857c 808c77e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 26 13:55:49 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 26 13:55:49 2014 -0500

    Merge topic 'revert-cached-regex-clear-for-master' into next
    
    808c77e2 Merge branch 'revert-cached-regex-clear' into revert-cached-regex-clear-for-master
    7d674b5f Revert "ClearMatches: Only clear matches which were actually set" (#15261)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=808c77e2319a4a81a86b2df3bf8fbba6bdbac7ac
commit 808c77e2319a4a81a86b2df3bf8fbba6bdbac7ac
Merge: 82582c9 7d674b5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 26 13:53:06 2014 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 26 13:53:06 2014 -0500

    Merge branch 'revert-cached-regex-clear' into revert-cached-regex-clear-for-master
    
    Resolve conflict in Source/cmMakefile.h by integrating both changes.

diff --cc Source/cmMakefile.h
index 41dddc3,28f8686..05b7a37
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@@ -972,13 -942,6 +972,10 @@@ public
                         std::string const& lhs,
                         std::string const& rhs);
  
-   void ClearMatches();
-   void StoreMatches(cmsys::RegularExpression& re);
- 
 +  void PushLoopBlock();
 +  void PopLoopBlock();
 +  bool IsLoopBlock() const;
 +
  protected:
    // add link libraries and directories to the target
    void AddGlobalLinkInformation(const std::string& name, cmTarget& target);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d674b5f0b28a610333644d417c2e8cb796cc9e4
commit 7d674b5f0b28a610333644d417c2e8cb796cc9e4
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Nov 26 12:55:44 2014 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 26 13:45:06 2014 -0500

    Revert "ClearMatches: Only clear matches which were actually set" (#15261)
    
    This reverts commit v3.1.0-rc1~557^2~2 (ClearMatches: Only clear matches
    which were actually set, 2014-03-12).  The optimization did not track
    the match count in the same scope as the variables, allowing possible
    inconsistency.
    
    Resolve conflicts in Source/cmIfCommand.cxx, Source/cmMakefile.cxx,
    and Source/cmMakefile.h by moving the changes to the new location
    of the code involved.

diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index aba26de..6065b8a 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -11,6 +11,7 @@
 ============================================================================*/
 
 #include "cmConditionEvaluator.h"
+#include "cmStringCommand.h"
 
 cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile):
   Makefile(makefile),
@@ -555,7 +556,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs,
         {
         def = this->GetVariableOrString(*arg);
         const char* rex = argP2->c_str();
-        this->Makefile.ClearMatches();
+        cmStringCommand::ClearMatches(&this->Makefile);
         cmsys::RegularExpression regEntry;
         if ( !regEntry.compile(rex) )
           {
@@ -567,7 +568,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs,
           }
         if (regEntry.find(def))
           {
-          this->Makefile.StoreMatches(regEntry);
+          cmStringCommand::StoreMatches(&this->Makefile, regEntry);
           *arg = cmExpandedCommandArgument("1", true);
           }
         else
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0bd1624..b7e89b8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -102,7 +102,6 @@ cmMakefile::cmMakefile(): Internal(new Internals)
   this->PreOrder = false;
   this->GeneratingBuildSystem = false;
 
-  this->NumLastMatches = 0;
   this->SuppressWatches = false;
 }
 
@@ -153,7 +152,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
   this->ListFileStack = mf.ListFileStack;
   this->OutputToSource = mf.OutputToSource;
 
-  this->NumLastMatches = mf.NumLastMatches;
   this->SuppressWatches = mf.SuppressWatches;
 }
 
@@ -4743,51 +4741,6 @@ std::vector<cmSourceFile*> cmMakefile::GetQtUiFilesWithOptions() const
   return this->QtUiFilesWithOptions;
 }
 
-static std::string matchVariables[] = {
-  "CMAKE_MATCH_0",
-  "CMAKE_MATCH_1",
-  "CMAKE_MATCH_2",
-  "CMAKE_MATCH_3",
-  "CMAKE_MATCH_4",
-  "CMAKE_MATCH_5",
-  "CMAKE_MATCH_6",
-  "CMAKE_MATCH_7",
-  "CMAKE_MATCH_8",
-  "CMAKE_MATCH_9"
-};
-
-//----------------------------------------------------------------------------
-void cmMakefile::ClearMatches()
-{
-  for (unsigned int i=0; i<this->NumLastMatches; i++)
-    {
-    std::string const& var = matchVariables[i];
-    std::string const& s = this->GetSafeDefinition(var);
-    if(!s.empty())
-      {
-      this->AddDefinition(var, "");
-      this->MarkVariableAsUsed(var);
-      }
-    }
-  this->NumLastMatches = 0;
-}
-
-//----------------------------------------------------------------------------
-void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
-{
-  for (unsigned int i=0; i<10; i++)
-    {
-    std::string const& m = re.match(i);
-    if(!m.empty())
-      {
-      std::string const& var = matchVariables[i];
-      this->AddDefinition(var, m.c_str());
-      this->MarkVariableAsUsed(var);
-      this->NumLastMatches = i + 1;
-      }
-    }
-}
-
 //----------------------------------------------------------------------------
 cmPolicies::PolicyStatus
 cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 164290a..28f8686 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -942,9 +942,6 @@ public:
                        std::string const& lhs,
                        std::string const& rhs);
 
-  void ClearMatches();
-  void StoreMatches(cmsys::RegularExpression& re);
-
 protected:
   // add link libraries and directories to the target
   void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
@@ -1150,8 +1147,6 @@ private:
 
   std::vector<cmSourceFile*> QtUiFilesWithOptions;
 
-  unsigned int NumLastMatches;
-
   bool AddRequiredTargetCFeature(cmTarget *target,
                                  const std::string& feature) const;
 
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 90a8f85..93aa083 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -310,7 +310,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
     input += args[i];
     }
 
-  this->Makefile->ClearMatches();
+  this->ClearMatches(this->Makefile);
   // Compile the regular expression.
   cmsys::RegularExpression re;
   if(!re.compile(regex.c_str()))
@@ -325,7 +325,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
   std::string output;
   if(re.find(input.c_str()))
     {
-    this->Makefile->StoreMatches(re);
+    this->StoreMatches(this->Makefile, re);
     std::string::size_type l = re.start();
     std::string::size_type r = re.end();
     if(r-l == 0)
@@ -359,7 +359,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
     input += args[i];
     }
 
-  this->Makefile->ClearMatches();
+  this->ClearMatches(this->Makefile);
   // Compile the regular expression.
   cmsys::RegularExpression re;
   if(!re.compile(regex.c_str()))
@@ -376,7 +376,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
   const char* p = input.c_str();
   while(re.find(p))
     {
-    this->Makefile->StoreMatches(re);
+    this->StoreMatches(this->Makefile, re);
     std::string::size_type l = re.start();
     std::string::size_type r = re.end();
     if(r-l == 0)
@@ -463,7 +463,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
     input += args[i];
     }
 
-  this->Makefile->ClearMatches();
+  this->ClearMatches(this->Makefile);
   // Compile the regular expression.
   cmsys::RegularExpression re;
   if(!re.compile(regex.c_str()))
@@ -480,7 +480,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
   std::string::size_type base = 0;
   while(re.find(input.c_str()+base))
     {
-    this->Makefile->StoreMatches(re);
+    this->StoreMatches(this->Makefile, re);
     std::string::size_type l2 = re.start();
     std::string::size_type r = re.end();
 
@@ -541,6 +541,38 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
 }
 
 //----------------------------------------------------------------------------
+void cmStringCommand::ClearMatches(cmMakefile* mf)
+{
+  for (unsigned int i=0; i<10; i++)
+    {
+    char name[128];
+    sprintf(name, "CMAKE_MATCH_%d", i);
+    const char* s = mf->GetDefinition(name);
+    if(s && *s != 0)
+      {
+      mf->AddDefinition(name, "");
+      mf->MarkVariableAsUsed(name);
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmStringCommand::StoreMatches(cmMakefile* mf,cmsys::RegularExpression& re)
+{
+  for (unsigned int i=0; i<10; i++)
+    {
+    std::string m = re.match(i);
+    if(m.size() > 0)
+      {
+      char name[128];
+      sprintf(name, "CMAKE_MATCH_%d", i);
+      mf->AddDefinition(name, re.match(i).c_str());
+      mf->MarkVariableAsUsed(name);
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
 bool cmStringCommand::HandleFindCommand(std::vector<std::string> const&
                                            args)
 {
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 9c75095..a5fe893 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -53,6 +53,8 @@ public:
   virtual std::string GetName() const { return "string";}
 
   cmTypeMacro(cmStringCommand, cmCommand);
+  static void ClearMatches(cmMakefile* mf);
+  static void StoreMatches(cmMakefile* mf, cmsys::RegularExpression& re);
 protected:
   bool HandleConfigureCommand(std::vector<std::string> const& args);
   bool HandleAsciiCommand(std::vector<std::string> const& args);

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

Summary of changes:
 Source/cmConditionEvaluator.cxx |    5 +++--
 Source/cmMakefile.cxx           |   47 ---------------------------------------
 Source/cmMakefile.h             |    5 -----
 Source/cmStringCommand.cxx      |   44 +++++++++++++++++++++++++++++++-----
 Source/cmStringCommand.h        |    2 ++
 5 files changed, 43 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list