cmMakefile: Create a scoped context for parsing listfiles.

Update the Syntax tests to check for updated/improved backtraces.
This commit is contained in:
Stephen Kelly 2015-07-05 19:28:45 +02:00 committed by Brad King
parent 30d44efaf8
commit 821f91d6ab
15 changed files with 79 additions and 16 deletions

View File

@ -547,6 +547,26 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
}
}
class cmParseFileScope
{
public:
cmParseFileScope(cmMakefile* mf)
: Makefile(mf)
{
this->Context.FilePath = this->Makefile->GetExecutionFilePath();
this->Makefile->ContextStack.push_back(&this->Context);
}
~cmParseFileScope()
{
this->Makefile->ContextStack.pop_back();
}
private:
cmMakefile* Makefile;
cmListFileContext Context;
};
bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE",
@ -558,10 +578,14 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
IncludeScope incScope(this, filenametoread, noPolicyScope);
cmListFile listFile;
{
cmParseFileScope pfs(this);
if (!listFile.ParseFile(filenametoread.c_str(), false, this))
{
return false;
}
}
this->ReadListFile(listFile, filenametoread);
if(cmSystemTools::GetFatalErrorOccured())
{
@ -619,10 +643,13 @@ bool cmMakefile::ReadListFile(const char* filename)
ListFileScope scope(this, filenametoread);
cmListFile listFile;
{
cmParseFileScope pfs(this);
if (!listFile.ParseFile(filenametoread.c_str(), false, this))
{
return false;
}
}
this->ReadListFile(listFile, filenametoread);
if(cmSystemTools::GetFatalErrorOccured())
@ -1738,11 +1765,14 @@ void cmMakefile::Configure()
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
cmListFile listFile;
{
cmParseFileScope pfs(this);
if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this))
{
this->SetConfigured();
return;
}
}
this->ReadListFile(listFile, currentStart);
if(cmSystemTools::GetFatalErrorOccured())
{

View File

@ -940,6 +940,7 @@ private:
std::vector<cmListFileContext const*> ContextStack;
std::vector<cmExecutionStatus*> ExecutionStatusStack;
friend class cmMakefileCall;
friend class cmParseFileScope;
std::vector<cmTarget*> ImportedTargetsOwned;
TargetMap ImportedTargets;

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BOM-UTF-16-BE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BOM-UTF-16-LE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BOM-UTF-32-BE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BOM-UTF-32-LE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace0.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace1.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace2.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace3.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace4.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,6 +1,8 @@
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in BracketNoSpace5.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,9 +1,11 @@
CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
CMake Warning \(dev\) in ParenInENV.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at ParenInENV.cmake:2 \(message\):

View File

@ -1,22 +1,28 @@
CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
CMake Warning \(dev\) in ParenNoSpace1.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
CMake Warning \(dev\) in ParenNoSpace1.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at CMakeLists.txt:3 \(include\):
CMake Error in ParenNoSpace1.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,17 +1,21 @@
CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
CMake Warning \(dev\) in StringNoSpace.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
CMake Warning \(dev\) in StringNoSpace.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31
Argument not separated from preceding token by whitespace.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
\[1 \${var} \\n 4\]