[cfe-dev] [PATCH] Warn against (uchar < 0) and (ushort < 0)
Xi Wang
xi.wang at gmail.com
Wed Feb 22 06:50:10 PST 2012
From: Zhihao Jia <dugushuiyi at gmail.com>
This patch adds support to warn against tautological comparisons like (uchar < 0) and (ushort < 0). See http://git.kernel.org/linus/3a7f8fb1 for an example.
Clang currently only warns against unsigned comparisons like (uint < 0). Clang ignores (uchar < 0) and (ushort < 0) because they are essentially signed comparisons, where uchar/ushort is sign-extended to signed int.
This patch changes one existing test case, where (bool < 0) is used.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warn_uchar_ushort.patch
Type: application/octet-stream
Size: 3660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120222/d12f9b61/attachment.obj>
More information about the cfe-dev
mailing list