From patchwork Thu Jan 23 18:12:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: parsers: fix 'unsigned expression is always true' warning (issue4142) From: David Soria Parra X-Patchwork-Id: 3403 Message-Id: To: mercurial-devel@selenic.com Date: Thu, 23 Jan 2014 19:12:24 +0100 # HG changeset patch # User David Soria Parra # 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; }