summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-06 20:33:15 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-06 20:33:15 (GMT)
commitc6fdff2b223d8527600a7df13638cd0258db4de7 (patch)
tree3c8c7bbbd0f3844bb18c06e21a5cb4407dfc06b2 /Source/cmFileCommand.cxx
parent20e6ac320d0d4b5ea9766d26e6215cc326ae071a (diff)
downloadCMake-c6fdff2b223d8527600a7df13638cd0258db4de7.zip
CMake-c6fdff2b223d8527600a7df13638cd0258db4de7.tar.gz
CMake-c6fdff2b223d8527600a7df13638cd0258db4de7.tar.bz2
Support more special characters in file(STRINGS)
The commits "Teach Fortran compiler identification about the Portland Group compiler" and "Fix previous change to file(STRINGS) command" taught file(STRINGS) to recognize the form-feed '\f' character as part of string literals. The Portland Group Fortran compiler also puts 0x14 bytes at the end of string literals in some cases. We generalize the previous solution and add the new character in this commit.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index a70ca75..609e95b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -531,6 +531,13 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
return false;
}
+ // At least one compiler (Portland Group Fortran) produces binaries
+ // with some extra characters in strings.
+ char extra[256]; // = {}; // some compilers do not like this
+ memset(extra, 0, sizeof(extra));
+ extra['\f'] = 1; // FF (form feed)
+ extra[0x14] = 1; // DC4 (device control 4)
+
// Parse strings out of the file.
int output_size = 0;
std::vector<std::string> strings;
@@ -585,7 +592,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{
// Ignore CR character to make output always have UNIX newlines.
}
- else if((c >= 0x20 && c < 0x7F) || c == '\t' || c == '\f' ||
+ else if((c >= 0x20 && c < 0x7F) || c == '\t' || extra[c] ||
(c == '\n' && newline_consume))
{
// This is an ASCII character that may be part of a string.