[Cmake-commits] CMake branch, next, updated. v3.0.2-2194-gaac38f8

Brad King brad.king at kitware.com
Fri Oct 24 13:37:41 EDT 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  aac38f88d4016191dbddc65a4ad5d1bb3fd8c9dd (commit)
       via  d1b62185d6b66b27a3ef31b79d4cff1c5126793e (commit)
       via  5f414cefb6524d26329484b296004e3c2d97ec4f (commit)
      from  e3db575e2e29789127fa40b2a7690aabd873a0b4 (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=aac38f88d4016191dbddc65a4ad5d1bb3fd8c9dd
commit aac38f88d4016191dbddc65a4ad5d1bb3fd8c9dd
Merge: e3db575 d1b6218
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Oct 24 13:37:40 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 24 13:37:40 2014 -0400

    Merge topic 'revert-definition-map-lookup' into next
    
    d1b62185 Merge branch 'parent-scope-tests' into variable-pull-failure
    5f414cef Revert "cmDefinitions: Don't store parent lookups"


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1b62185d6b66b27a3ef31b79d4cff1c5126793e
commit d1b62185d6b66b27a3ef31b79d4cff1c5126793e
Merge: 5f414ce e0c0b1a
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Oct 24 13:00:28 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 24 13:34:30 2014 -0400

    Merge branch 'parent-scope-tests' into variable-pull-failure
    
    * parent-scope-tests:
      test: add a test for PARENT_SCOPE with multiple scopes
      test: add test for PARENT_SCOPE behavior
    
    Conflicts:
    	Tests/RunCMake/set/RunCMakeTest.cmake

diff --cc Tests/RunCMake/set/RunCMakeTest.cmake
index 1b51ea2,0b96b28..b8e8cf1
--- a/Tests/RunCMake/set/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set/RunCMakeTest.cmake
@@@ -1,3 -1,5 +1,5 @@@
  include(RunCMake)
  
 -run_cmake(PARENT_SCOPE)
 +run_cmake(ParentScope)
+ run_cmake(ParentPulling)
+ run_cmake(ParentPullingRecursive)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f414cefb6524d26329484b296004e3c2d97ec4f
commit 5f414cefb6524d26329484b296004e3c2d97ec4f
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Oct 24 12:58:12 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 24 13:31:21 2014 -0400

    Revert "cmDefinitions: Don't store parent lookups"
    
    This reverts commit 5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49.
    
    The behaviors associated with implicit pulldown on variable lookup
    seriously conflict with the optimizations made in these commits.
    Basically, since values were copied upon variable lookup, not just on
    PARENT_SCOPE, coupled with PARENT_SCOPE's behavior based on whether the
    variable is in the current scope or not causes serious problems with not
    storing a value for every variable at every scope.
    
    The commit changed behavior of the following example, among other cases:
    
      function(test_set)
        set(blah "value2")
        message("before PARENT_SCOPE blah=${blah}")
        set(blah ${blah} PARENT_SCOPE)
        message("after PARENT_SCOPE blah=${blah}")
      endfunction()
      set(blah value1)
      test_set()
      message("in parent scope, blah=${blah}")
    
    Reported-by: Alex Merry <alex.merry at kde.org>
    Reported-by: Ben Cooksley <bcooksley at kde.org>

diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 98becf8..babf1c4 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -28,7 +28,7 @@ void cmDefinitions::Reset(cmDefinitions* parent)
 
 //----------------------------------------------------------------------------
 cmDefinitions::Def const&
-cmDefinitions::GetInternal(const std::string& key) const
+cmDefinitions::GetInternal(const std::string& key)
 {
   MapType::const_iterator i = this->Map.find(key);
   if(i != this->Map.end())
@@ -37,8 +37,9 @@ cmDefinitions::GetInternal(const std::string& key) const
     }
   else if(cmDefinitions* up = this->Up)
     {
-    // Query the parent scope.
-    return up->GetInternal(key);
+    // Query the parent scope and store the result locally.
+    Def def = up->GetInternal(key);
+    return this->Map.insert(MapType::value_type(key, def)).first->second;
     }
   return this->NoDef;
 }
@@ -70,26 +71,13 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def)
 }
 
 //----------------------------------------------------------------------------
-const char* cmDefinitions::Get(const std::string& key) const
+const char* cmDefinitions::Get(const std::string& key)
 {
   Def const& def = this->GetInternal(key);
   return def.Exists? def.c_str() : 0;
 }
 
 //----------------------------------------------------------------------------
-void cmDefinitions::Pull(const std::string& key)
-{
-  if (this->Up)
-    {
-    Def const& def = this->Up->GetInternal(key);
-    if (def.Exists)
-      {
-      this->SetInternal(key, def);
-      }
-    }
-}
-
-//----------------------------------------------------------------------------
 const char* cmDefinitions::Set(const std::string& key, const char* value)
 {
   Def const& def = this->SetInternal(key, Def(value));
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index ebe6fa5..d615fb0 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -33,11 +33,9 @@ public:
   /** Returns the parent scope, if any.  */
   cmDefinitions* GetParent() const { return this->Up; }
 
-  /** Get the value associated with a key; null if none. */
-  const char* Get(const std::string& key) const;
-
-  /** Pull a variable from the parent. */
-  void Pull(const std::string& key);
+  /** Get the value associated with a key; null if none.
+      Store the result locally if it came from a parent.  */
+  const char* Get(const std::string& key);
 
   /** Set (or unset if null) a value associated with a key.  */
   const char* Set(const std::string& key, const char* value);
@@ -75,7 +73,7 @@ private:
   MapType Map;
 
   // Internal query and update methods.
-  Def const& GetInternal(const std::string& key) const;
+  Def const& GetInternal(const std::string& key);
   Def const& SetInternal(const std::string& key, Def const& def);
 
   // Implementation of Closure() method.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 412c998..630957f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4422,7 +4422,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
   if(cmDefinitions* up = cur.GetParent())
     {
     // First localize the definition in the current scope.
-    cur.Pull(var);
+    cur.Get(var);
 
     // Now update the definition in the parent scope.
     up->Set(var, varDef);

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list