[cfe-commits] [PATCH] Enhance -Wtautological-compare

Xi Wang xi.wang at gmail.com
Wed Feb 29 08:36:05 PST 2012


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.

- xi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scmp.patch
Type: application/octet-stream
Size: 7203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120229/a4d962e6/attachment.obj>


More information about the cfe-commits mailing list