This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch c++]: Fix warnings in decl2.c
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Kai Tietz <ktietz70 at googlemail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 1 Jul 2010 09:01:19 +0200
- Subject: Re: [patch c++]: Fix warnings in decl2.c
- References: <AANLkTinqML45CQaJfpiG6LJVt-xp2SpegXOov0Ji99ir@mail.gmail.com> <4C2BB6FE.7000303@redhat.com> <AANLkTim0ln5zaRykxLXAs6ZPYugJeixrWYzMdkVM_9qJ@mail.gmail.com> <4C2C19D9.30300@redhat.com>
On 1 July 2010 06:30, Jason Merrill <jason@redhat.com> wrote:
> On 06/30/2010 05:31 PM, Manuel LÃpez-IbÃÅez wrote:
>>
>> On 30 June 2010 23:28, Jason Merrill<jason@redhat.com> Âwrote:
>>>
>>> On 06/09/2010 10:53 AM, Kai Tietz wrote:
>>>>
>>>> 2010-06-09 ÂKai Tietz
>>>>
>>>> Â Â Â Â* decl2.c (min_vis_r):
>>>> Â Â Â Â(constrain_visibility):
>>>
>>> Odd ChangeLog entry :)
>>>
>>> I would rather fix these warnings by changing the type of the variable
>>> itself, but that looks to be complicated in this case, so I guess this
>>> patch
>>> is OK.
>>
>> Are these valid warnings at all? The fact that we don't warn for this
>> in recent GCC either suggests that they are not or that we have
>> regressed in terms of diagnostics.
>
> Well, since there are no negative values in enum symbol_visibility, I
> believe that GCC makes it compatible with unsigned int, so comparing such a
> value to int is indeed a comparison between signed and unsigned. ÂBut since
> DECL_VISIBILITY is a bit-field, the possible range of values is less than
> the range of the type, so the comparison is safe and the warning is a false
> positive.
So if trunk regresses in this diagnostic aspect, we won't detect it
because we are adding workarounds for old broken compilers that are
not needed in trunk. Great.
Manuel.