Ping?

The most recent patch is attached.  Please review.  Thanks. ;-)

This patch enhances Clang to catch tautological comparisons
such as (uchar < 0) and (uchar == -1), which are often logic
bugs that break the error handling.

 docs/ReleaseNotes.html                       |    3 +-
 include/clang/Basic/DiagnosticSemaKinds.td   |    7 +--
 lib/Sema/SemaChecking.cpp                    |   95 +++++++++++++++-----------
 test/Sema/compare.c                          |   23 +++++--
 test/SemaTemplate/instantiate-function-1.cpp |    2 +-

Attachment: cmp.patch
Description: Binary data

On Mar 2, 2012, at 1:45 AM, Xi Wang wrote:

> 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.
> 
> <scmp2.patch>
> 

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to