Przeglądaj źródła

CMP0010: Remove support for OLD behavior

Brad King 1 rok temu
rodzic
commit
cf832e75bc

+ 5 - 4
Help/policy/CMP0010.rst

@@ -1,6 +1,9 @@
 CMP0010
 CMP0010
 -------
 -------
 
 
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
 Bad variable reference syntax is an error.
 Bad variable reference syntax is an error.
 
 
 In CMake 2.6.2 and below, incorrect variable reference syntax such as
 In CMake 2.6.2 and below, incorrect variable reference syntax such as
@@ -14,7 +17,5 @@ If :policy:`CMP0053` is set to ``NEW``, this policy has no effect
 and is treated as always being ``NEW``.
 and is treated as always being ``NEW``.
 
 
 .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.3
 .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.3
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt

+ 0 - 26
Source/cmMakefile.cxx

@@ -2880,30 +2880,7 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
       error += cmStrCat("at\n  ", filename, ':', line, '\n');
       error += cmStrCat("at\n  ", filename, ':', line, '\n');
     }
     }
     error += cmStrCat("when parsing string\n  ", source, '\n', emsg);
     error += cmStrCat("when parsing string\n  ", source, '\n', emsg);
-
-    // If the parser failed ("res" is false) then this is a real
-    // argument parsing error, so the policy applies.  Otherwise the
-    // parser reported an error message without failing because the
-    // helper implementation is unhappy, which has always reported an
-    // error.
     mtype = MessageType::FATAL_ERROR;
     mtype = MessageType::FATAL_ERROR;
-    if (!res) {
-      // This is a real argument parsing error.  Use policy CMP0010 to
-      // decide whether it is an error.
-      switch (this->GetPolicyStatus(cmPolicies::CMP0010)) {
-        case cmPolicies::WARN:
-          error +=
-            cmStrCat('\n', cmPolicies::GetPolicyWarning(cmPolicies::CMP0010));
-          CM_FALLTHROUGH;
-        case cmPolicies::OLD:
-          // OLD behavior is to just warn and continue.
-          mtype = MessageType::AUTHOR_WARNING;
-          break;
-        case cmPolicies::NEW:
-          // NEW behavior is to report the error.
-          break;
-      }
-    }
     errorstr = std::move(error);
     errorstr = std::move(error);
   }
   }
   return mtype;
   return mtype;
@@ -3236,9 +3213,6 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
 
 
   // Check for open variable references yet.
   // Check for open variable references yet.
   if (!error && !openstack.empty()) {
   if (!error && !openstack.empty()) {
-    // There's an open variable reference waiting.  Policy CMP0010 flags
-    // whether this is an error or not.  The new parser now enforces
-    // CMP0010 as well.
     errorstr += "There is an unterminated variable reference.";
     errorstr += "There is an unterminated variable reference.";
     error = true;
     error = true;
   }
   }

+ 1 - 1
Source/cmPolicies.h

@@ -44,7 +44,7 @@ class cmMakefile;
          "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
          "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
          6, 2, NEW)                                                           \
          6, 2, NEW)                                                           \
   SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
   SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
-         3, WARN)                                                             \
+         3, NEW)                                                              \
   SELECT(POLICY, CMP0011,                                                     \
   SELECT(POLICY, CMP0011,                                                     \
          "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
          "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
          WARN)                                                                \
          WARN)                                                                \

+ 1 - 1
Tests/RunCMake/Syntax/CMakeLists.txt

@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.0)
 project(${RunCMake_TEST} NONE)
 project(${RunCMake_TEST} NONE)
 include(${RunCMake_TEST}.cmake)
 include(${RunCMake_TEST}.cmake)

+ 0 - 1
Tests/RunCMake/Syntax/RunCMakeTest.cmake

@@ -69,7 +69,6 @@ run_cmake(UnterminatedCall2)
 run_cmake(UnterminatedString)
 run_cmake(UnterminatedString)
 run_cmake(UnterminatedBrace0)
 run_cmake(UnterminatedBrace0)
 run_cmake(UnterminatedBrace1)
 run_cmake(UnterminatedBrace1)
-run_cmake(UnterminatedBrace2)
 run_cmake(UnterminatedBracket0)
 run_cmake(UnterminatedBracket0)
 run_cmake(UnterminatedBracket1)
 run_cmake(UnterminatedBracket1)
 run_cmake(UnterminatedBracketComment)
 run_cmake(UnterminatedBracketComment)

+ 0 - 0
Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt → Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt


+ 2 - 3
Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at UnterminatedBrace1.cmake:2 \(set\):
+CMake Error at UnterminatedBrace1.cmake:2 \(set\):
   Syntax error in cmake code at
   Syntax error in cmake code at
 
 
     .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:2
     .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:2
@@ -7,7 +7,6 @@ CMake Warning \(dev\) at UnterminatedBrace1.cmake:2 \(set\):
 
 
     \${
     \${
 
 
-  syntax error, unexpected end of file, expecting } \(3\)
+  There is an unterminated variable reference.
 Call Stack \(most recent call first\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
   CMakeLists.txt:3 \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.

+ 1 - 1
Tests/RunCMake/Syntax/UnterminatedBrace1.cmake

@@ -1,2 +1,2 @@
-cmake_policy(SET CMP0010 OLD)
+cmake_policy(SET CMP0053 NEW)
 set(var "${")
 set(var "${")

+ 0 - 12
Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt

@@ -1,12 +0,0 @@
-CMake Error at UnterminatedBrace2.cmake:3 \(set\):
-  Syntax error in cmake code at
-
-    .*/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake:3
-
-  when parsing string
-
-    \${
-
-  There is an unterminated variable reference.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)

+ 0 - 3
Tests/RunCMake/Syntax/UnterminatedBrace2.cmake

@@ -1,3 +0,0 @@
-cmake_policy(SET CMP0010 OLD)
-cmake_policy(SET CMP0053 NEW)
-set(var "${")