bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glr.c cleanup


From: Joel E. Denny
Subject: Re: glr.c cleanup
Date: Wed, 14 Dec 2005 02:14:54 -0500 (EST)

On Mon, 12 Dec 2005, Paul Eggert wrote:

> "Joel E. Denny" <address@hidden> writes:
> 
> > By the way, lint still gives some `implicit narrowing conversion' warnings 
> > for both yacc.c and glr.c.  Have you seen them?
> 
> Just for yacc.c.  The GNU Coding standards say "Don't make the program
> ugly to placate 'lint'" and I couldn't think of a way to placate lint
> without uglifying the code greatly, so I ignored them.

I'm really just wondering about the narrowing itself.  Was it intentional?  
For yacc.c, I get one warning.  For glr.c, I get 6.  They're all about 
assigning an int to a short int.  Is the int for compatibility with 
yylex()?  And the short int is an optimization?

> The best idea I came up with was the following macro, but it's pretty
> ugly....
> 
> /* Narrow VAL to TYPE.  Lint complains about narrowing conversions
>    unless there is an explicit cast, so put one in.  However, explicit
>    casts can mask other errors, so omit the cast in the non-lint case.  */
> #ifdef lint
> # define YYNARROW(type, val) ((type) (val))
> #else
> # define YYNARROW(type, val) (val)
> #endif

I actually don't find that so ugly.  It tells me that the narrowing is 
intentional.  However, I fear my sense of ugly may be underdeveloped.

Joel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]