bug-bison
[Top][All Lists]
Advanced

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

Re: lint warnings from `bison -y' generated files


From: Paul Eggert
Subject: Re: lint warnings from `bison -y' generated files
Date: Tue, 04 Oct 2005 12:43:37 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Nicolas Joly <address@hidden> writes:

> - (void)yyvaluepn;      ... line 842.

Thanks for reporting the problem.  Would substituting "yyvaluepn =
yyvaluepn;" for "(void) yyvaluepn;" suffice to turn off that warning?

> - do {} while (0)       ... lines 1023/1024.
> - if (0) {}             ... line 1358.
>
> Except for the fisrt one, it should be easy to fix them by adding a
> `/*CONSTCOND*/' lint directive.

I dunno about this one.  Bison uses constant operands in a lot of
places in conditional contexts; it relies on the compiler optimizing
away the test and the unused branch.  In some cases Bison itself
doesn't know whether the expression is conditional (that is determined
partly by the context in which the parser is compiled), so we can't
just blithely insert /*CONSTCOND*/ all over the place.  Also, let's
face it, /*CONSTCOND*/ is ugly.

Can't you just ask 'lint' to be quiet about this particular problem
instead?  Complaining about constants used in conditional contexts
might have made sense back in the 1970s, but today it seems
counterproductive -- in some sense you're asking modern compilers to
please not optimize so much!




reply via email to

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