[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: fixed yycheck signed/unsigned comparison warnings
From: |
Joel E. Denny |
Subject: |
Re: FYI: fixed yycheck signed/unsigned comparison warnings |
Date: |
Fri, 11 Aug 2006 20:02:01 -0400 (EDT) |
On Fri, 11 Aug 2006, Paul Eggert wrote:
> "Joel E. Denny" <address@hidden> writes:
>
> > I configure bison with --enable-gcc-warnings. I tried adding a new token
> > to parse-gram.y today, but it failed to compile as gcc complained of
> > comparisons between signed and unsigned for yycheck.
>
> In practice that warning causes a lot of makework, and I think it
> harms more than it helps since the extra casts might disguise other
> problems.
It occurs to me now that I really cast the wrong thing. In
yycheck[i]==other_value, I shouldn't have cast yycheck[i] to int. I
should have cast other_value to unsigned int. That should be ok since the
code is obviously assuming other_value is greater than zero, or the
comparison would be broken anyway. Would that cast disguise any problems
that -Wno-sign-compare doesn't also disguise?
> I installed the following patch to disable that warning
> instead of having the casts.
I fear we may lose legitimate warnings. It seems better to lose this
warning only for some well examined cases rather than for all future
cases.
Joel