diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 442553dd0d..1f32283012 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -1,6 +1,9 @@ CMP0010 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Bad variable reference syntax is an error. 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``. .. |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 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4c773e1823..a639564193 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2880,30 +2880,7 @@ MessageType cmMakefile::ExpandVariablesInStringOld( error += cmStrCat("at\n ", filename, ':', line, '\n'); } 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; - 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); } return mtype; @@ -3236,9 +3213,6 @@ MessageType cmMakefile::ExpandVariablesInStringNew( // Check for open variable references yet. 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."; error = true; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 186ea428e1..429b12e0c9 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -44,7 +44,7 @@ class cmMakefile; "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \ 6, 2, NEW) \ SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \ - 3, WARN) \ + 3, NEW) \ SELECT(POLICY, CMP0011, \ "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \ WARN) \ diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt index 4b3de84d94..2897109554 100644 --- a/Tests/RunCMake/Syntax/CMakeLists.txt +++ b/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) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index f56ac64753..af6eb6c02f 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -69,7 +69,6 @@ run_cmake(UnterminatedCall2) run_cmake(UnterminatedString) run_cmake(UnterminatedBrace0) run_cmake(UnterminatedBrace1) -run_cmake(UnterminatedBrace2) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt similarity index 100% rename from Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt rename to Tests/RunCMake/Syntax/UnterminatedBrace1-result.txt diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt index 3d88f36158..4df56d1e30 100644 --- a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt +++ b/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 .*/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\): CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake index 8b40b19df9..db39af7269 100644 --- a/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake @@ -1,2 +1,2 @@ -cmake_policy(SET CMP0010 OLD) +cmake_policy(SET CMP0053 NEW) set(var "${") diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt deleted file mode 100644 index 0d76251bf6..0000000000 --- a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt +++ /dev/null @@ -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\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake deleted file mode 100644 index 30d4d4d46d..0000000000 --- a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake +++ /dev/null @@ -1,3 +0,0 @@ -cmake_policy(SET CMP0010 OLD) -cmake_policy(SET CMP0053 NEW) -set(var "${")