On Sep 28, 2011, at 10:25 PM, Matt Beaumont-Gay wrote:

> On Wed, Sep 28, 2011 at 11:47, John McCall <[email protected]> wrote:
>> 
>> On Sep 26, 2011, at 6:10 PM, Chandler Carruth wrote:
>> 
>> On Mon, Sep 26, 2011 at 4:39 PM, John McCall <[email protected]> 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?

Your quoting style is broken;  please use something that divides responses 
properly.

> The noisy warning in question is floating-point-literal-to-int, which
> fires on a lot of code like "int kNumMicrosPerSecond = 1e6;". How
> would you feel about moving that warning under a more specific flag?
> And, to get slightly off-topic, how would you feel about adding code
> to that warning to silence it in "safe" cases for literals written in
> exponential form?

I think we should definitely not be warning for conversions that
preserve values exactly.

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

Reply via email to