bug-bison
[Top][All Lists]
Advanced

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

Re: %destructor feedback


From: Paul Eggert
Subject: Re: %destructor feedback
Date: Wed, 07 Dec 2005 09:44:27 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Akim Demaille <address@hidden> writes:

> I'd rather say that we should special case YYUSE.  For instance when
> the compiler is GCC, or when lint is used etc.  From this thread it
> seems there is no single answer, let's forge a multiple one.

Unfortunately I don't think that would work, because lint discards
its funny comments when used inside macros.  So, for example, if we
did this:

#if defined lint
# define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
#else
# define YYUSE(e) ((void) (e))
#endif

the /*CONSTCOND*/ is lost before lint "sees" it, so lint complains
about the constant expression in the use.  (This is the problem we're
currently facing with the existing YYUSE.)

We could dump YYUSE, and replace all instances of

   YYUSE(e);

with

   #ifdef __GNUC__
     (void) (e);
   #else
     do {;} while (/*CONSTCOND*/ 0 && (e));
   #endif

This could be done with an m4 macro, I suppose.  The resulting parser
would look ugly though, and be even harder to maintain.

More in keeping with lint would be to put /*ARGUSED*/ in the skelton,
before every function that uses YYUSE.  A bit ugly too, but perhaps
that's the simplest solution.




reply via email to

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