[Cmake-commits] CMake branch, next, updated. v3.4.1-2007-g5c0d5f0
Brad King
brad.king at kitware.com
Tue Jan 19 10:20:16 EST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 5c0d5f06d4e3a021abf17b2469ef7f7e0103b2fd (commit)
via 77cd74a3ea964fa390d85c371902387e9ffc4a92 (commit)
from 29b8a5bbf4460d565822bd6e46a8ea08d9ffb166 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c0d5f06d4e3a021abf17b2469ef7f7e0103b2fd
commit 5c0d5f06d4e3a021abf17b2469ef7f7e0103b2fd
Merge: 29b8a5b 77cd74a
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jan 19 10:20:15 2016 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jan 19 10:20:15 2016 -0500
Merge topic 'cache-parse-error-line-number' into next
77cd74a3 Print line number of cache parse errors (#11109)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77cd74a3ea964fa390d85c371902387e9ffc4a92
commit 77cd74a3ea964fa390d85c371902387e9ffc4a92
Author: Ashley Whetter <ashley at awhetter.co.uk>
AuthorDate: Sun Jan 17 22:09:30 2016 +0000
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 19 10:19:42 2016 -0500
Print line number of cache parse errors (#11109)
Track the line number while parsing `CMakeCache.txt` files and include
it in a parse failure error message.
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index ce8af55..7466c29 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -64,12 +64,14 @@ bool cmCacheManager::LoadCache(const std::string& path,
const char *realbuffer;
std::string buffer;
std::string entryKey;
+ unsigned int lineno = 0;
while(fin)
{
// Format is key:type=value
std::string helpString;
CacheEntry e;
cmSystemTools::GetLineFromStream(fin, buffer);
+ lineno++;
realbuffer = buffer.c_str();
while(*realbuffer != '0' &&
(*realbuffer == ' ' ||
@@ -77,6 +79,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
*realbuffer == '\r' ||
*realbuffer == '\n'))
{
+ if (*realbuffer == '\n') lineno++;
realbuffer++;
}
// skip blank lines and comment lines
@@ -96,6 +99,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
helpString += &realbuffer[2];
}
cmSystemTools::GetLineFromStream(fin, buffer);
+ lineno++;
realbuffer = buffer.c_str();
if(!fin)
{
@@ -138,8 +142,10 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
else
{
- cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(),
- ". Offending entry: ", realbuffer);
+ std::ostringstream error;
+ error << "Parse error in cache file " << cacheFile;
+ error << " on line " << lineno << ". Offending entry: " << realbuffer;
+ cmSystemTools::Error(error.str().c_str());
}
}
this->CacheMajorVersion = 0;
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index e77ba1f..8068973 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -33,6 +33,11 @@ run_cmake_command(build-bad-dir
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
+run_cmake_command(cache-bad-entry
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/)
+run_cmake_command(cache-empty-entry
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/)
+
function(run_BuildDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt
new file mode 100644
index 0000000..150d2ca
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt on line 7. Offending entry: BAD ENTRY.*
diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt
new file mode 100644
index 0000000..75cd7c2
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt
@@ -0,0 +1,10 @@
+# This is a comment
+
+// That was an empty line. This isn't.
+EMPTY_LINE:BOOL=FALSE
+
+// Uhoh! Here it comes
+BAD ENTRY
+
+// This is fine
+GOOD_ENTRY:BOOL=TRUE
diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt
new file mode 100644
index 0000000..54f4452
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt on line 5. Offending entry:.*
diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt
new file mode 100644
index 0000000..44da1c9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt
@@ -0,0 +1,7 @@
+// This is valid
+VALID:BOOL=TRUE
+
+// This isn't
+
+// One final entry
+FINAL:BOOL=TRUE
-----------------------------------------------------------------------
Summary of changes:
Source/cmCacheManager.cxx | 10 ++++++++--
Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 +++++
.../cache-bad-entry-result.txt} | 0
Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt | 1 +
Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt | 10 ++++++++++
.../cache-empty-entry-result.txt} | 0
Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt | 1 +
Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt | 7 +++++++
8 files changed, 32 insertions(+), 2 deletions(-)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CommandLine/cache-bad-entry-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt
create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CommandLine/cache-empty-entry-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt
create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list