Преглед на файлове

ENH: make CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS the default and remove the property. If any value is specified in an endif, endforeach, endwhile, etc then make sure it matches the start string. If no values are given then it is no longer an error.

Bill Hoffman преди 17 години
родител
ревизия
f386c2aae0
променени са 6 файла, в които са добавени 21 реда и са изтрити 28 реда
  1. 4 4
      Source/cmForEachCommand.cxx
  2. 5 5
      Source/cmFunctionCommand.cxx
  3. 4 3
      Source/cmIfCommand.cxx
  4. 4 4
      Source/cmMacroCommand.cxx
  5. 0 9
      Source/cmMakefile.cxx
  6. 4 3
      Source/cmWhileCommand.cxx

+ 4 - 4
Source/cmForEachCommand.cxx

@@ -103,10 +103,10 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf)
     {
     std::vector<std::string> expandedArguments;
     mf.ExpandArguments(lff.Arguments, expandedArguments);
-    if ((!expandedArguments.empty() && 
-         (expandedArguments[0] == this->Args[0]))
-        || cmSystemTools::IsOn
-        (mf.GetPropertyOrDefinition("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")))
+    // if the endforeach has arguments then make sure
+    // they match the begin foreach arguments
+    if ((expandedArguments.empty() ||
+         (expandedArguments[0] == this->Args[0])))
       {
       return true;
       }

+ 5 - 5
Source/cmFunctionCommand.cxx

@@ -252,11 +252,11 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
   if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction"))
     {
     std::vector<std::string> expandedArguments;
-    mf.ExpandArguments(lff.Arguments, expandedArguments);
-    if ((!expandedArguments.empty() && 
-        (expandedArguments[0] == this->Args[0]))
-        || cmSystemTools::IsOn
-        (mf.GetPropertyOrDefinition("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")))
+    mf.ExpandArguments(lff.Arguments, expandedArguments); 
+    // if the endfunction has arguments then make sure
+    // they match the ones in the openeing function command
+    if ((expandedArguments.empty() ||
+         (expandedArguments[0] == this->Args[0])))
       {
       return true;
       }

+ 4 - 3
Source/cmIfCommand.cxx

@@ -145,9 +145,10 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
 {
   if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif"))
     {
-    if (cmSystemTools::IsOn
-        (mf.GetPropertyOrDefinition("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS"))
-        || lff.Arguments == this->Args)
+    // if the endif has arguments, then make sure
+    // they match the arguments of the matching if
+    if (lff.Arguments.size() == 0 ||
+        lff.Arguments == this->Args)
       {
       return true;
       }

+ 4 - 4
Source/cmMacroCommand.cxx

@@ -329,10 +329,10 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
     {
     std::vector<std::string> expandedArguments;
     mf.ExpandArguments(lff.Arguments, expandedArguments);
-    if ((!expandedArguments.empty() && 
-        (expandedArguments[0] == this->Args[0]))
-        || cmSystemTools::IsOn
-        (mf.GetPropertyOrDefinition("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")))
+    // if the endmacro has arguments make sure they
+    // match the arguments of the macro
+    if ((expandedArguments.empty() ||
+         (expandedArguments[0] == this->Args[0])))
       {
       return true;
       }

+ 0 - 9
Source/cmMakefile.cxx

@@ -3038,15 +3038,6 @@ void cmMakefile::DefineProperties(cmake *cm)
      "If this is true then the outputs of custom commands for this "
      "directory will not be removed during the \"make clean\" stage. ");
 
-  cm->DefineProperty
-    ("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS", cmProperty::DIRECTORY,
-     "Allow loops to have non-matching closing statements.",
-     "If this is set then the closing statement of control "
-     "structures in CMake will not require an exact match to the "
-     "opening statement. For example  IF(foo) will not require "
-     "ENDIF(foo) but simple ENDIF() will work.",
-     true);
-
   cm->DefineProperty
     ("LISTFILE_STACK", cmProperty::DIRECTORY,
      "The current stack of listfiles being processed.",

+ 4 - 3
Source/cmWhileCommand.cxx

@@ -93,9 +93,10 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf)
 {
   if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile"))
     {
-    if (lff.Arguments == this->Args
-        || cmSystemTools::IsOn
-        (mf.GetPropertyOrDefinition("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")))
+    // if the endwhile has arguments, then make sure
+    // they match the arguments of the matching while
+    if (lff.Arguments.size() == 0 ||
+        lff.Arguments == this->Args)
       {
       return true;
       }