summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-10-02 17:28:55 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2001-10-02 17:28:55 -0400
commit8591786867111568298394242a80ddc0a321f5ad (patch)
treedd9b0251953724c9189d6d7bc103567573dbc6a0
parentc9caf2390c86b98bbeca1e4e52d04fbbb563f083 (diff)
downloadcmake-8591786867111568298394242a80ddc0a321f5ad.tar.gz
ENH: add better error reports in parsing cmake files, like what file has the error
-rw-r--r--Source/cmListFileCache.cxx3
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmSystemTools.cxx10
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/ctest.cxx2
5 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 1fade07616..19eafac2ce 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -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);
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f3e777e01c..760fe36f77 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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());
}
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 0e5c81e2fb..a7df5bffe4 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -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;
}
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index b724bc7ff7..2f03f473e6 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -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.
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 8395b1e327..24cf666571 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -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")
{