On Wed, 7 Dec 2005, Frank Heckenbach wrote:
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
It is used at the next YYUSE() execution:
And for the last (or only) one?
Yeah, sorry, that was stupid. I was still thinking of my global
declaration.
, and if declared globally, a compiler cannot
readily optimize away the spurious assignment.
Unless YYUSE() appears in a short loop (not in bison, I believe), wouldn't
the performance penalty be trivial?
Probably, though if the macro is made available to the user, they
may use it in a short loop ...
My idea of making it available to the user never caught on. After your
previous arguments against YYUSE(), I proposed YYBISON_USE() to handle our
RHS semantic value issue. It would be available to the user, but it would
hide its arguments from the compiler.
I'm wondering if any kind of performance penalty is justified only
to please lint ...
Personally, I don't ever use lint (although it's looking kind of
interesting). But if bison has to deal with this because people want it,
then I believe the loss of functionality incurred by previous YYUSE
definitions is worse than a small performance penalty. Perhaps there
should be a flag to #define YYUSE(e) as nothing when the user wants to
swap warnings for small performance improvements.
Joel