bug-bison
[Top][All Lists]
Advanced

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

Re: %destructor feedback


From: Joel E. Denny
Subject: Re: %destructor feedback
Date: Sun, 23 Oct 2005 02:23:19 -0400 (EDT)

On Sun, 23 Oct 2005, Frank Heckenbach wrote:

Joel E. Denny wrote:

YYUSE is really a no-op.  In other words:

   $5;

is nearly equivalent to:

   YYUSE($5);

The first would be compatible with any bison version.

... and would likely produce a compiler-warning. Exchanging a Bison
warning for a compiler warning doesn't really gain much.

I clearly didn't think that one through. Thanks. I'm not sure why I left that in the email given how much more readable it would be for the user to write his own macro inside a #ifndef.

Basically yes. (Though the recent development of YYUSE and your
following comment seem to show that it isn't quite that easy to
write a general-purpose warning-free YYUSE ...)

I guess YYUSE was really intended to suppress warnings from the C compiler, which may be tricky as you suggest. Our warnings would come from bison, so try this instead:

  #define YYBISON_USE( param ) /* Empty. */

Example usage:

  YYBISON_USE( $1 )
  YYBISON_USE(( $1, $2, $3 ))

Thus, bison sees the $1, $2, and $3, but the C compiler sees nothing after preprocessing.

Again, the user himself could write this macro in a #ifndef for compatibility with prior bison releases.

OTOH, making the warning optional shouldn't take more than a global
flag in Bison unless I'm missing something.

If someone wants to implement the global flag, I won't argue.  I just
worry that...

I guess I could write those few lines, if that's the main problem. ;-)

I wasn't trying to argue that it would be difficult to implement the flag. I meant to say that I had a small misgiving about the flag that I thought ought to be considered, but if anyone proposes a patch to implement the flag, I for one won't bother to argue against it.

Joel




reply via email to

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