[Cmake-commits] [cmake-commits] king committed cmIfCommand.cxx 1.90 1.91 cmMakefile.cxx 1.491 1.492 cmMakefile.h 1.241 1.242

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jan 20 14:35:24 EST 2009


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

Modified Files:
	cmIfCommand.cxx cmMakefile.cxx cmMakefile.h 
Log Message:
ENH: Improve response to bad if or elseif

Previously bad arguments to an if() or elseif() would cause some
subsequent statements in the corresponding block to execute.  This
teaches CMake to stop processing commands with a fatal error.  It also
provides context to bad elseif() error messages.


Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.90
retrieving revision 1.91
diff -C 2 -d -r1.90 -r1.91
*** cmIfCommand.cxx	1 Oct 2008 13:04:27 -0000	1.90
--- cmIfCommand.cxx	20 Jan 2009 19:35:21 -0000	1.91
***************
*** 77,80 ****
--- 77,84 ----
            else
              {
+             // Place this call on the call stack.
+             cmMakefileCall stack_manager(&mf, this->Functions[c], status);
+             static_cast<void>(stack_manager);
+ 
              std::string errorString;
              
***************
*** 99,104 ****
                err += errorString;
                err += ").";
!               cmSystemTools::Error(err.c_str());
!               return false;
                }
          
--- 103,110 ----
                err += errorString;
                err += ").";
!               mf.IssueMessage(cmake::FATAL_ERROR, err);
!               cmSystemTools::SetFatalErrorOccured();
!               mf.RemoveFunctionBlocker(lff);
!               return true;
                }
          
***************
*** 205,208 ****
--- 211,215 ----
      err += ").";
      this->SetError(err.c_str());
+     cmSystemTools::SetFatalErrorOccured();
      return false;
      }

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.241
retrieving revision 1.242
diff -C 2 -d -r1.241 -r1.242
*** cmMakefile.h	15 Jan 2009 19:37:14 -0000	1.241
--- cmMakefile.h	20 Jan 2009 19:35:22 -0000	1.242
***************
*** 922,925 ****
--- 922,944 ----
  };
  
+ //----------------------------------------------------------------------------
+ // Helper class to make sure the call stack is valid.
+ class cmMakefileCall
+ {
+ public:
+   cmMakefileCall(cmMakefile* mf,
+                  cmListFileContext const& lfc,
+                  cmExecutionStatus& status): Makefile(mf)
+     {
+     cmMakefile::CallStackEntry entry = {&lfc, &status};
+     this->Makefile->CallStack.push_back(entry);
+     }
+   ~cmMakefileCall()
+     {
+     this->Makefile->CallStack.pop_back();
+     }
+ private:
+   cmMakefile* Makefile;
+ };
  
  #endif

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.491
retrieving revision 1.492
diff -C 2 -d -r1.491 -r1.492
*** cmMakefile.cxx	18 Jan 2009 17:05:45 -0000	1.491
--- cmMakefile.cxx	20 Jan 2009 19:35:21 -0000	1.492
***************
*** 350,373 ****
  
  //----------------------------------------------------------------------------
- // Helper class to make sure the call stack is valid.
- class cmMakefileCall
- {
- public:
-   cmMakefileCall(cmMakefile* mf,
-                  cmListFileContext const& lfc,
-                  cmExecutionStatus& status): Makefile(mf)
-     {
-     cmMakefile::CallStackEntry entry = {&lfc, &status};
-     this->Makefile->CallStack.push_back(entry);
-     }
-   ~cmMakefileCall()
-     {
-     this->Makefile->CallStack.pop_back();
-     }
- private:
-   cmMakefile* Makefile;
- };
- 
- //----------------------------------------------------------------------------
  bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
                                  cmExecutionStatus &status)
--- 350,353 ----



More information about the Cmake-commits mailing list