diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-10-02 21:28:55 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-10-02 21:28:55 (GMT) |
commit | 8591786867111568298394242a80ddc0a321f5ad (patch) | |
tree | dd9b0251953724c9189d6d7bc103567573dbc6a0 /Source | |
parent | c9caf2390c86b98bbeca1e4e52d04fbbb563f083 (diff) | |
download | CMake-8591786867111568298394242a80ddc0a321f5ad.zip CMake-8591786867111568298394242a80ddc0a321f5ad.tar.gz CMake-8591786867111568298394242a80ddc0a321f5ad.tar.bz2 |
ENH: add better error reports in parsing cmake files, like what file has the error
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmListFileCache.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 10 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 6 | ||||
-rw-r--r-- | Source/ctest.cxx | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 1fade07..19eafac 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 f3e777e..760fe36 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 0e5c81e..a7df5bf 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 b724bc7..2f03f47 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 8395b1e..24cf666 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") { |