[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.499 1.500 cmMakefile.h 1.250 1.251

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jan 22 13:16:29 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv2226/Source

Modified Files:
	cmMakefile.cxx cmMakefile.h 
Log Message:
ENH: Create notion of a 'weak' policy stack entry

A 'weak' poilcy stack entry responds normally to queries.  However,
setting a policy in a weak entry will recursively set the policy in the
next entry too.  This also gives the internal interface to create a weak
entry the option to provide an initial PolicyMap for it.


Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.250
retrieving revision 1.251
diff -C 2 -d -r1.250 -r1.251
*** cmMakefile.h	22 Jan 2009 15:57:16 -0000	1.250
--- cmMakefile.h	22 Jan 2009 18:16:27 -0000	1.251
***************
*** 350,354 ****
    {
    public:
!     PolicyPushPop(cmMakefile* m);
      ~PolicyPushPop();
      void Quiet() { this->ReportError = false; }
--- 350,356 ----
    {
    public:
!     PolicyPushPop(cmMakefile* m,
!                   bool weak = false,
!                   cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap());
      ~PolicyPushPop();
      void Quiet() { this->ReportError = false; }
***************
*** 944,948 ****
  
    // Internal policy stack management.
!   void PushPolicy();
    void PopPolicy();
    void PushPolicyBarrier();
--- 946,951 ----
  
    // Internal policy stack management.
!   void PushPolicy(bool weak = false,
!                   cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap());
    void PopPolicy();
    void PushPolicyBarrier();
***************
*** 956,962 ****
    {
      typedef cmPolicies::PolicyMap derived;
!     PolicyStackEntry(): derived() {}
!     PolicyStackEntry(derived const& d): derived(d) {}
!     PolicyStackEntry(PolicyStackEntry const& r): derived(r) {}
    };
    typedef std::vector<PolicyStackEntry> PolicyStackType;
--- 959,966 ----
    {
      typedef cmPolicies::PolicyMap derived;
!     PolicyStackEntry(bool w = false): derived(), Weak(w) {}
!     PolicyStackEntry(derived const& d, bool w = false): derived(d), Weak(w) {}
!     PolicyStackEntry(PolicyStackEntry const& r): derived(r), Weak(r.Weak) {}
!     bool Weak;
    };
    typedef std::vector<PolicyStackEntry> PolicyStackType;

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.499
retrieving revision 1.500
diff -C 2 -d -r1.499 -r1.500
*** cmMakefile.cxx	22 Jan 2009 15:57:15 -0000	1.499
--- cmMakefile.cxx	22 Jan 2009 18:16:27 -0000	1.500
***************
*** 3667,3672 ****
      }
  
!   // Store the setting.
!   this->PolicyStack.back()[id] = status;
  
    // Special hook for presenting compatibility variable as soon as
--- 3667,3678 ----
      }
  
!   // Update the policy stack from the top to the top-most strong entry.
!   bool previous_was_weak = true;
!   for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin();
!       previous_was_weak && psi != this->PolicyStack.rend(); ++psi)
!     {
!     (*psi)[id] = status;
!     previous_was_weak = psi->Weak;
!     }
  
    // Special hook for presenting compatibility variable as soon as
***************
*** 3693,3700 ****
  
  //----------------------------------------------------------------------------
! cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m):
    Makefile(m), ReportError(true)
  {
!   this->Makefile->PushPolicy();
    this->Makefile->PushPolicyBarrier();
  }
--- 3699,3707 ----
  
  //----------------------------------------------------------------------------
! cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak,
!                                          cmPolicies::PolicyMap const& pm):
    Makefile(m), ReportError(true)
  {
!   this->Makefile->PushPolicy(weak, pm);
    this->Makefile->PushPolicyBarrier();
  }
***************
*** 3708,3715 ****
  
  //----------------------------------------------------------------------------
! void cmMakefile::PushPolicy()
  {
    // Allocate a new stack entry.
!   this->PolicyStack.push_back(PolicyStackEntry());
  }
  
--- 3715,3722 ----
  
  //----------------------------------------------------------------------------
! void cmMakefile::PushPolicy(bool weak, cmPolicies::PolicyMap const& pm)
  {
    // Allocate a new stack entry.
!   this->PolicyStack.push_back(PolicyStackEntry(pm, weak));
  }
  



More information about the Cmake-commits mailing list