[llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp
Reid Spencer
reid at x10sys.com
Wed Oct 18 13:24:06 PDT 2006
Changes in directory llvm/lib/Support:
FileUtilities.cpp updated: 1.50 -> 1.51
---
Log message:
Beef up the output from DiffFilesWithTolerance by setting the error code
to describe the difference being reported. This assists with understanding
differences an llvm-test and should help with bugpoint too.
---
Diffs of the changes: (+16 -3)
FileUtilities.cpp | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.50 llvm/lib/Support/FileUtilities.cpp:1.51
--- llvm/lib/Support/FileUtilities.cpp:1.50 Wed Aug 23 15:37:59 2006
+++ llvm/lib/Support/FileUtilities.cpp Wed Oct 18 15:23:52 2006
@@ -85,7 +85,13 @@
}
if (F1NumEnd == F1P || F2NumEnd == F2P) {
- if (ErrorMsg) *ErrorMsg = "Comparison failed, not a numeric difference.";
+ if (ErrorMsg) {
+ *ErrorMsg = "FP Comparison failed, not a numeric difference between '";
+ *ErrorMsg += F1P[0];
+ *ErrorMsg += "' and '";
+ *ErrorMsg += F2P[0];
+ *ErrorMsg += "'";
+ }
return true;
}
@@ -160,9 +166,13 @@
// If they are both zero sized then they're the same
if (A_size == 0 && B_size == 0)
return 0;
+
// If only one of them is zero sized then they can't be the same
- if ((A_size == 0 || B_size == 0))
+ if ((A_size == 0 || B_size == 0)) {
+ if (Error)
+ *Error = "Files differ: one is zero-sized, the other isn't";
return 1;
+ }
// Now its safe to mmap the files into memory becasue both files
// have a non-zero size.
@@ -190,8 +200,11 @@
if (std::memcmp(File1Start, File2Start, A_size) == 0)
return 0;
- if (AbsTol == 0 && RelTol == 0)
+ if (AbsTol == 0 && RelTol == 0) {
+ if (Error)
+ *Error = "Files differ without tolerance allowance";
return 1; // Files different!
+ }
}
char *OrigFile1Start = File1Start;
More information about the llvm-commits
mailing list