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

Joerg Sonnenberger joerg at britannica.bec.de
Fri Mar 2 09:52:45 PST 2012


On Fri, Mar 02, 2012 at 12:40:10PM -0500, Xi Wang wrote:
> On Mar 2, 2012, at 10:18 AM, Joerg Sonnenberger wrote:
> > On Thu, Mar 01, 2012 at 11:53:37PM -0500, Xi Wang wrote:
> >> 
> >> It warns against (char < 0) with -funsigned-char.
> > 
> > I think that's bad since such conditionals are used as sanity checks,
> > e.g. by some implementations of ctype.h.
> 
> I didn't make it clear.  The patch doesn't do anything to detect
> such options.  I tried the patched code with -funsigned-char and
> it was able to warn against (char < 0).  So I guess the warning
> should fire on platforms that treat plain char as unsigned char.

That's my point. Warning about char being checked for being < 0 can be
found a lot in portable code. It is not automatically tautological, so I
don't think it should trigger the check.

Joerg



More information about the cfe-commits mailing list