summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-08-09 18:48:24 (GMT)
committerAlex Turbov <i.zaufi@gmail.com>2021-08-09 19:35:11 (GMT)
commite97e714f0d59809fcefdc94feaadedb319d252c6 (patch)
tree5129b65091504c190f086bcdec671a796758baf3
parent880ca66b51551d5ee732c7b81349c1a5f724d093 (diff)
downloadCMake-e97e714f0d59809fcefdc94feaadedb319d252c6.zip
CMake-e97e714f0d59809fcefdc94feaadedb319d252c6.tar.gz
CMake-e97e714f0d59809fcefdc94feaadedb319d252c6.tar.bz2
Fix: `while()` reports an error the same way as `if()`
With arguments list expanded.
-rw-r--r--Source/cmWhileCommand.cxx12
-rw-r--r--Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt7
2 files changed, 10 insertions, 9 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 1363386..8938663 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -16,6 +16,7 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmOutputConverter.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -100,16 +101,13 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
}
if (!isTrue && !errorString.empty()) {
- std::string err = "had incorrect arguments: ";
- for (cmListFileArgument const& arg : this->Args) {
- err += (arg.Delim ? "\"" : "");
- err += arg.Value;
- err += (arg.Delim ? "\"" : "");
+ std::string err = "had incorrect arguments:\n ";
+ for (cmExpandedCommandArgument const& i : expandedArguments) {
err += " ";
+ err += cmOutputConverter::EscapeForCMake(i.GetValue());
}
- err += "(";
+ err += "\n";
err += errorString;
- err += ").";
mf.GetCMakeInstance()->IssueMessage(messageType, err, whileBT);
if (messageType == MessageType::FATAL_ERROR) {
cmSystemTools::SetFatalErrorOccured();
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt b/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt
index 33ac54a..9d4132c 100644
--- a/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt
+++ b/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt
@@ -1,5 +1,8 @@
CMake Error at unbalanced-parenthesis.cmake:[0-9]+ \(while\):
- had incorrect arguments: NOT \$\{var_with_paren\} IN_LIST some_list
- \(mismatched parenthesis in condition\).
+ had incorrect arguments:
+
+ "NOT" "\(" "IN_LIST" "some_list"
+
+ mismatched parenthesis in condition
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)