[cfe-commits] r140574 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td test/SemaCXX/warn-literal-conversion.cpp test/SemaCXX/warn-string-conversion.cpp

John McCall rjmccall at apple.com
Wed Sep 28 11:47:55 PDT 2011


On Sep 26, 2011, at 6:10 PM, Chandler Carruth wrote:
> On Mon, Sep 26, 2011 at 4:39 PM, John McCall <rjmccall at apple.com> wrote:
> > The string literal to boolean conversion is a new warning.  There was
> > some discussion of where to put it, from literal-conversion or
> > bool-conversion.  I was moving it to its own flag so we can have the
> > warning while we figure out which of these places would be best for
> > it.
> 
> Okay, as long as it doesn't stay there.  And for next time, it's fine to just let it sit in one or the other until the discussion is done, I think.
> 
> This was largely my request to Richard. Essentially, -Wliteral-conversion fires a great deal, with a high false-positive rate. We're considering turning it on anyways, but I can imagine a lot of code may never be interested in turning that set of warnings on.
> 
> However, -Wbool-conversion and this new warning Richard added were based on specific bug reports. We've found hundreds of bugs with these two warnings, and very few false-positives. I originally suggested just putting both of these under 'bool-conversion' even though one is converting from a bool to a pointer, and the other from a pointer to a bool. I would be happy with consolidating them into any flag name that seems appropriate and sufficiently descriptive. My only real goal is to keep the extremely high-value warnings available even when -Wliteral-conversion (much less the even more noisy variants) aren't feasible for a codebase.

So let me turn this around.  False-to-pointer and string-literal-to-bool conversions are both clearly under the rubric of -Wliteral-conversion.  I can understand not wanting to turn on a category with massive false positives, but, well, massive false positives are a fixable problem.  Why don't we just put the noisy cases into their own categories, not part of -Wliteral-conversion, and then move them back in if/when we fix their problems?

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110928/43be8e67/attachment.html>


More information about the cfe-commits mailing list