[Cmake-commits] [cmake-commits] king committed cmForEachCommand.cxx 1.29 1.30 cmFunctionCommand.cxx 1.8 1.9 cmIfCommand.cxx 1.93 1.94 cmMacroCommand.cxx 1.38 1.39 cmMakefile.cxx 1.495 1.496 cmMakefile.h 1.245 1.246 cmWhileCommand.cxx 1.15 1.16

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 21 09:49:03 EST 2009


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

Modified Files:
	cmForEachCommand.cxx cmFunctionCommand.cxx cmIfCommand.cxx 
	cmMacroCommand.cxx cmMakefile.cxx cmMakefile.h 
	cmWhileCommand.cxx 
Log Message:
ENH: Better handling of mismatched blocks

If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command).  The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command.  Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.

This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch.  The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.


Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.93
retrieving revision 1.94
diff -C 2 -d -r1.93 -r1.94
*** cmIfCommand.cxx	21 Jan 2009 14:48:20 -0000	1.93
--- cmIfCommand.cxx	21 Jan 2009 14:49:00 -0000	1.94
***************
*** 40,44 ****
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(lff));
        if(!fb.get()) { return false; }
  
--- 40,45 ----
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker>
!         fb(mf.RemoveFunctionBlocker(this, lff));
        if(!fb.get()) { return false; }
  

Index: cmWhileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmWhileCommand.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmWhileCommand.cxx	21 Jan 2009 14:48:20 -0000	1.15
--- cmWhileCommand.cxx	21 Jan 2009 14:49:00 -0000	1.16
***************
*** 34,38 ****
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(lff));
        if(!fb.get()) { return false; }
  
--- 34,39 ----
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker>
!         fb(mf.RemoveFunctionBlocker(this, lff));
        if(!fb.get()) { return false; }
  

Index: cmMacroCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMacroCommand.cxx,v
retrieving revision 1.38
retrieving revision 1.39
diff -C 2 -d -r1.38 -r1.39
*** cmMacroCommand.cxx	21 Jan 2009 14:48:20 -0000	1.38
--- cmMacroCommand.cxx	21 Jan 2009 14:49:00 -0000	1.39
***************
*** 267,271 ****
  
        // remove the function blocker now that the macro is defined
!       mf.RemoveFunctionBlocker(lff);
        return true;
        }
--- 267,271 ----
  
        // remove the function blocker now that the macro is defined
!       mf.RemoveFunctionBlocker(this, lff);
        return true;
        }

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.245
retrieving revision 1.246
diff -C 2 -d -r1.245 -r1.246
*** cmMakefile.h	21 Jan 2009 14:48:20 -0000	1.245
--- cmMakefile.h	21 Jan 2009 14:49:00 -0000	1.246
***************
*** 96,100 ****
     */
    cmsys::auto_ptr<cmFunctionBlocker>
!   RemoveFunctionBlocker(const cmListFileFunction& lff);
  
    /** Push/pop a lexical (function blocker) barrier automatically.  */
--- 96,100 ----
     */
    cmsys::auto_ptr<cmFunctionBlocker>
!   RemoveFunctionBlocker(cmFunctionBlocker* fb, const cmListFileFunction& lff);
  
    /** Push/pop a lexical (function blocker) barrier automatically.  */

Index: cmFunctionCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFunctionCommand.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** cmFunctionCommand.cxx	21 Jan 2009 14:48:17 -0000	1.8
--- cmFunctionCommand.cxx	21 Jan 2009 14:49:00 -0000	1.9
***************
*** 223,227 ****
  
        // remove the function blocker now that the function is defined
!       mf.RemoveFunctionBlocker(lff);
        return true;
        }
--- 223,227 ----
  
        // remove the function blocker now that the function is defined
!       mf.RemoveFunctionBlocker(this, lff);
        return true;
        }

Index: cmForEachCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmForEachCommand.cxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -C 2 -d -r1.29 -r1.30
*** cmForEachCommand.cxx	21 Jan 2009 14:48:16 -0000	1.29
--- cmForEachCommand.cxx	21 Jan 2009 14:49:00 -0000	1.30
***************
*** 32,36 ****
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(lff));
        if(!fb.get()) { return false; }
  
--- 32,37 ----
        {
        // Remove the function blocker for this scope or bail.
!       cmsys::auto_ptr<cmFunctionBlocker>
!         fb(mf.RemoveFunctionBlocker(this, lff));
        if(!fb.get()) { return false; }
  

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.495
retrieving revision 1.496
diff -C 2 -d -r1.495 -r1.496
*** cmMakefile.cxx	21 Jan 2009 14:48:20 -0000	1.495
--- cmMakefile.cxx	21 Jan 2009 14:49:00 -0000	1.496
***************
*** 2423,2427 ****
  
  cmsys::auto_ptr<cmFunctionBlocker>
! cmMakefile::RemoveFunctionBlocker(const cmListFileFunction& lff)
  {
    // Find the function blocker stack barrier for the current scope.
--- 2423,2428 ----
  
  cmsys::auto_ptr<cmFunctionBlocker>
! cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
!                                   const cmListFileFunction& lff)
  {
    // Find the function blocker stack barrier for the current scope.
***************
*** 2439,2444 ****
      std::vector<cmFunctionBlocker*>::iterator pos =
        this->FunctionBlockers.begin() + (i - 1);
!     if ((*pos)->ShouldRemove(lff, *this))
        {
        cmFunctionBlocker* b = *pos;
        this->FunctionBlockers.erase(pos);
--- 2440,2457 ----
      std::vector<cmFunctionBlocker*>::iterator pos =
        this->FunctionBlockers.begin() + (i - 1);
!     if (*pos == fb)
        {
+       // Warn if the arguments do not match, but always remove.
+       if(!(*pos)->ShouldRemove(lff, *this))
+         {
+         cmListFileContext const& lfc = fb->GetStartingContext();
+         cmOStringStream e;
+         e << "A logical block opening on the line\n"
+           << "  " << lfc << "\n"
+           << "closes on the line\n"
+           << "  " << lff << "\n"
+           << "with mis-matching arguments.";
+         this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+         }
        cmFunctionBlocker* b = *pos;
        this->FunctionBlockers.erase(pos);



More information about the Cmake-commits mailing list