bug-bison
[Top][All Lists]
Advanced

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

Re: %destructor feedback


From: Frank Heckenbach
Subject: Re: %destructor feedback
Date: Wed, 7 Dec 2005 03:36:44 +0100
User-agent: semail 20050409

Paul Eggert wrote:

> "Joel E. Denny" <address@hidden> writes:
> 
> > Did you try my static global variable solution?  It worked for my
> > tests, but again it should probably be tested with other lints.
> 
> If you're talking about this one:
> 
>   static int yyunused;
>   #define YYUSE(e) yyunused = (int*) &(e) && yyunused
> 
> then I suspect it will also run afoul of lint implementations that
> deduce that &(e) can never be null, and print a warning.  Also, I
> don't like having an unnecessary static variable around.  Also, it
> won't work if e is declared to be a register, as you can't take
> addresses of registers.

And doesn't it also prevent the compiler from putting e in a
register (when applied to a local variable), thus pessimizing the
code generated?

And what about the yyunused variable? If it's declared locally, some
version of a compiler or lint may find that it's assigned a value
that's never used, and if declared globally, a compiler cannot
readily optimize away the spurious assignment.

So may I hypothesize that for any way of doing it that allows a
compiler to optimize it away, there may be some compiler or lint
warning that detects and complains about this fact? Then, unless
there's some "official" way to do it without warning, this whole
issue seems rather hopeless, with any solution just waiting to break
with the next compiler or lint version tested with ...

For gcc, there are AFAIK (at least) two ways of doing it, attribute
unused and cast to void. With various lint versions, there doesn't
seem to be any.

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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