diff options
author | Brad King <brad.king@kitware.com> | 2022-03-04 13:53:09 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-03-04 13:53:16 (GMT) |
commit | d7febfc72722c3d304e31b8de6bed837e115616f (patch) | |
tree | 6fe76d8e00e9210fe65da79d0a76fa4cc97c79c2 /Source | |
parent | 71a8b4e63dd8c80b1c09c665c81a510835174828 (diff) | |
parent | da2361ffb35799319abca6f7c3138c916685fb2d (diff) | |
download | CMake-d7febfc72722c3d304e31b8de6bed837e115616f.zip CMake-d7febfc72722c3d304e31b8de6bed837e115616f.tar.gz CMake-d7febfc72722c3d304e31b8de6bed837e115616f.tar.bz2 |
Merge topic 'while-bug-compatibility' into release-3.23
da2361ffb3 while: Restore tolerance of condition error
47d197745a Tests: Simplify RunCMake.{if,while} unbalanced parenthesis cases
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7041
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmWhileCommand.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index b8297ce..a93a81f 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -79,12 +79,17 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, return out; }; + // FIXME(#23296): For compatibility with older versions of CMake, we + // tolerate condition errors that evaluate to false. We should add + // a policy to enforce such errors. + bool enforceError = true; std::string errorString; MessageType messageType; for (cmConditionEvaluator conditionEvaluator(mf, whileBT); - conditionEvaluator.IsTrue(expandArgs(this->Args, expandedArguments), - errorString, messageType);) { + (enforceError = /* enforce condition errors that evaluate to true */ + conditionEvaluator.IsTrue(expandArgs(this->Args, expandedArguments), + errorString, messageType));) { // Invoke all the functions that were collected in the block. for (cmListFileFunction const& fn : functions) { cmExecutionStatus status(mf); @@ -105,7 +110,7 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, } } - if (!errorString.empty()) { + if (!errorString.empty() && enforceError) { std::string err = "had incorrect arguments:\n "; for (auto const& i : expandedArguments) { err += " "; |