[cfe-commits] [PATCH v2] Enhance -Wtautological-compare
Xi Wang
xi.wang at gmail.com
Thu Mar 1 22:45:05 PST 2012
Attached is a v2 that incorporates comments from Richard. A unified
function is used for checking trivial signed/unsigned comparisons.
- xi
On Feb 29, 2012, at 11:36 AM, Xi Wang wrote:
> Clang doesn't issue warnings against tautological comparisons like
> (uchar < 0) and (uchar == -1). Such tautological comparisons are
> often logic bugs that break the error handling. Below are some
> recent examples.
>
> http://git.kernel.org/linus/3a7f8fb1
> http://git.kernel.org/linus/589665f5
> http://git.kernel.org/linus/4690c33d
>
> This patch enhances Clang to catch such tautological comparisons,
> where bool/uchar/ushort is sign-extended to signed int. Clang
> currently only warns against unsigned tautological comparisons.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scmp2.patch
Type: application/octet-stream
Size: 10382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120302/9567424e/attachment.obj>
-------------- next part --------------
More information about the cfe-commits
mailing list