[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
Thu Sep 29 01:23:28 CDT 2011

On Sep 28, 2011, at 11:19 PM, Matt Beaumont-Gay wrote:
> On Wed, Sep 28, 2011 at 22:52, John McCall <rjmccall at apple.com> wrote:
>> On Sep 28, 2011, at 10:25 PM, Matt Beaumont-Gay wrote:
>>> 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.
> I'd still like to warn on "int i = 1.0", since we can offer a fixit
> hint that is always a strict (if minor) improvement.

Sure, that seems reasonable;  we can gate it on the existence of a
floating point.


More information about the cfe-commits mailing list