cmListFileCache: When missing ending ) print starting line instead of last one

Fixes: #19301
This commit is contained in:
Bartosz Kosiorek
2019-05-30 09:18:16 +02:00
committed by Brad King
parent 187928875d
commit 3475e2728b
5 changed files with 10 additions and 7 deletions

View File

@@ -192,12 +192,9 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
}
// Arguments.
unsigned long lastLine;
unsigned long parenDepth = 0;
this->Separation = SeparationOkay;
while (
(static_cast<void>(lastLine = cmListFileLexer_GetCurrentLine(this->Lexer)),
token = cmListFileLexer_Scan(this->Lexer))) {
while ((token = cmListFileLexer_Scan(this->Lexer))) {
if (token->type == cmListFileLexer_Token_Space ||
token->type == cmListFileLexer_Token_Newline) {
this->Separation = SeparationOkay;
@@ -252,7 +249,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
std::ostringstream error;
cmListFileContext lfc;
lfc.FilePath = this->FileName;
lfc.Line = lastLine;
lfc.Line = line;
cmListFileBacktrace lfbt = this->Backtrace;
lfbt = lfbt.Push(lfc);
error << "Parse error. Function missing ending \")\". "

View File

@@ -1,4 +1,4 @@
CMake Error at UnterminatedCall1.cmake:2:
CMake Error at UnterminatedCall1.cmake:1:
Parse error. Function missing ending "\)". End of file reached.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -1 +1,4 @@
message(
message("Additional message")

View File

@@ -1,4 +1,4 @@
CMake Error at UnterminatedCall2.cmake:4:
CMake Error at UnterminatedCall2.cmake:3:
Parse error. Function missing ending "\)". End of file reached.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -1,3 +1,6 @@
set(var "\
")
message(
message("Additional message")