ENH: add better error reports in parsing cmake files, like what file has the error

This commit is contained in:
Bill Hoffman 2001-10-02 17:28:55 -04:00
parent c9caf2390c
commit 8591786867
5 changed files with 16 additions and 9 deletions

View File

@ -76,7 +76,8 @@ bool cmListFileCache::CacheFile(const char* path)
cmListFileFunction inFunction;
if(cmSystemTools::ParseFunction(fin,
inFunction.m_Name,
inFunction.m_Arguments))
inFunction.m_Arguments,
path))
{
inFile.m_Functions.push_back(inFunction);
}

View File

@ -256,7 +256,9 @@ void cmMakefile::ExecuteCommand(std::string &name,
}
else
{
cmSystemTools::Error("unknown CMake command ", name.c_str());
cmSystemTools::Error("unknown CMake command:", name.c_str(),
"\nReading cmake file in directory:" ,
m_cmCurrentDirectory.c_str());
}
}

View File

@ -486,7 +486,8 @@ const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path)
bool cmSystemTools::ParseFunction(std::ifstream& fin,
std::string& name,
std::vector<std::string>& arguments)
std::vector<std::string>& arguments,
const char* filename)
{
name = "";
arguments = std::vector<std::string>();
@ -551,8 +552,8 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
}
else
{
cmSystemTools::Error("Parse error in read function missing end )",
inbuffer);
cmSystemTools::Error("Parse error in read function missing end )\nIn File: ",
filename, "\nCurrent line:", inbuffer);
return false;
}
}
@ -560,7 +561,8 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
}
else
{
cmSystemTools::Error("Parse error in read function ", inbuffer);
cmSystemTools::Error("Parse error in read function\nIn file:",
filename, "\nCurrent line:", inbuffer);
return false;
}
}

View File

@ -122,11 +122,13 @@ public:
/**
* Read a CMake command (or function) from an input file. This
* returns the name of the function and a list of its
* arguments.
* arguments. The last argument is the name of the file that
* the ifstream points to, and is used for debug info only.
*/
static bool ParseFunction(std::ifstream&,
std::string& name,
std::vector<std::string>& arguments);
std::vector<std::string>& arguments,
const char* filename);
/**
* Extract white-space separated arguments from a string.

View File

@ -109,7 +109,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
while ( fin )
{
if(cmSystemTools::ParseFunction(fin, name, args))
if(cmSystemTools::ParseFunction(fin, name, args, "DartTestfile.txt"))
{
if (name == "SUBDIRS")
{