[PATCH] parsers: fix 'unsigned expression is always true' warning (issue4142)

David Soria Parra davidsp at fb.com
Thu Jan 23 12:12:24 CST 2014


# HG changeset patch
# User David Soria Parra <davidsp at fb.com>
# Date 1390500506 -3600
#      Thu Jan 23 19:08:26 2014 +0100
# Branch stable
# Node ID a1293f8acae8a1e3e918d32ecc88ed3525cc1b15
# Parent  dbf305f499613e6b833847b72f1eb5424f9331cc
parsers: fix 'unsigned expression is always true' warning (issue4142)

On Mac OS gcc-llvm throws an -Wtautological-compare warning because flen
is defined as an unsigned integer, therefore flen < 0 is always true.

diff -r dbf305f49961 -r a1293f8acae8 mercurial/parsers.c
--- a/mercurial/parsers.c	Tue Jan 21 14:44:40 2014 -0600
+++ b/mercurial/parsers.c	Thu Jan 23 19:08:26 2014 +0100
@@ -185,7 +185,7 @@
 		flen = getbe32(cur + 13);
 		pos += 17;
 		cur += 17;
-		if (flen > len - pos || flen < 0) {
+		if (flen > len - pos) {
 			PyErr_SetString(PyExc_ValueError, "overflow in dirstate");
 			goto quit;
 		}


More information about the Mercurial-devel mailing list