[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.454 1.455

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 10 15:41:09 EDT 2008


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

Modified Files:
	cmMakefile.cxx 
Log Message:
ENH: Enforce matching PUSH/POP calls for cmake_policy.


Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.454
retrieving revision 1.455
diff -C 2 -d -r1.454 -r1.455
*** cmMakefile.cxx	10 Mar 2008 19:40:57 -0000	1.454
--- cmMakefile.cxx	10 Mar 2008 19:41:07 -0000	1.455
***************
*** 580,583 ****
--- 580,584 ----
    // add this list file to the list of dependencies
    this->ListFiles.push_back( filenametoread);
+   bool endScopeNicely = filename? true: false;
    const size_t numberFunctions = cacheFile.Functions.size();
    for(size_t i =0; i < numberFunctions; ++i)
***************
*** 588,602 ****
          cmSystemTools::GetFatalErrorOccured() )
        {
!       // pop the listfile off the stack
!       this->ListFileStack.pop_back();
!       this->AddDefinition("CMAKE_PARENT_LIST_FILE",
!                           currentParentFile.c_str());
!       this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
!       return true;
        }
      }
  
    // send scope ended to and function blockers
!   if (filename)
      {
      // loop over all function blockers to see if any block this command
--- 589,600 ----
          cmSystemTools::GetFatalErrorOccured() )
        {
!       // Exit early from processing this file.
!       endScopeNicely = false;
!       break;
        }
      }
  
    // send scope ended to and function blockers
!   if (endScopeNicely)
      {
      // loop over all function blockers to see if any block this command
***************
*** 614,617 ****
--- 612,629 ----
      }
  
+   // If this is the directory-level CMakeLists.txt file then enforce
+   // policy stack depth.
+   if(this->ListFileStack.size() == 1)
+     {
+     while(this->PolicyStack.size() > 1)
+       {
+       if(endScopeNicely)
+         {
+         this->IssueError("cmake_policy PUSH without matching POP");
+         }
+       this->PopPolicy(false);
+       }
+     }
+ 
    this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
    this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());



More information about the Cmake-commits mailing list