[cfe-commits] r164143 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaChecking.cpp test/Analysis/additive-folding.cpp test/Sema/compare.c test/Sema/outof-range-constant-compare.c te

jahanian fjahanian at apple.com
Mon Oct 1 13:28:55 PDT 2012


On Oct 1, 2012, at 9:30 AM, jahanian <fjahanian at apple.com> wrote:

> 
> On Sep 30, 2012, at 9:16 PM, Nico Weber <thakis at chromium.org> wrote:
> 
>> On Wed, Sep 26, 2012 at 6:40 AM, John McCall <rjmccall at apple.com> wrote:
>>> On Sep 25, 2012, at 8:29 AM, Hans Wennborg wrote:
>>>> On Tue, Sep 18, 2012 at 6:37 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>>>>> Author: fjahanian
>>>>> Date: Tue Sep 18 12:37:21 2012
>>>>> New Revision: 164143
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=164143&view=rev
>>>>> Log:
>>>>> c: warn when an integer value comparison with an
>>>>> integral expression have the obvious result.
>>>>> Patch reviewed by John McCall off line.
>>>>> // rdar://12202422
>>>> 
>>>> This triggers a couple of warnings in Chromium. (We're tracking it at
>>>> http://crbug.com/151927) Most look like bugs, but this one doesn't
>>>> really:
>>>> 
>>>> /usr/local/google/work/chrome/src/v8/src/utils.h:977:20: warning:
>>>> comparison of constant 32 with expression of type
>>>> 'v8::internal::AstPropertiesFlag' is always true
>>>> [-Wtautological-constant-out-of-range-compare]
>>>>  ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT));
>>>>  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> 
>>>> The code, with context, is available at [1]. This is in a class
>>>> template, and 'element' has the type of a template parameter, so
>>>> depending on what type the template is instantiated with, the
>>>> comparison might be tautological or not. Perhaps the warning shouldn't
>>>> fire for expressions that depend on template parameters?
>>> 
>>> Yes, I think this is probably a reasonable request for all of the
>>> tautological-comparison warnings.
>> 
>> Fariborz, do you have time to look at this tweak? Or do you want us to do it?
> 
> Sorry, I missed on this thread. I will do it after my current task. But please go ahead 
> and do the tweak to meet your schedule.

This has been a long standing issue and there is http://llvm.org/bugs/show_bug.cgi?id=8682 
to track it. It is low priority for us at this time. Please feel free to look at it if you have time.

- Fariborz

> - Fariborz 
>> 
>>> 
>>> John.
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list