[Top][All Lists]

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

Re: beta testing

From: Philippe Bekaert
Subject: Re: beta testing
Date: Wed, 21 Feb 2001 12:05:45 +0100

Hans Aberg wrote:
> >> This problem  is due to the fact that the .tab.h file does not have the
> >> standard type of header macro-conditionals
> >>   #ifndef foo_bar_header
> >>   #define foo_bar_header
> >>   ...
> >>   #endif /* foo_bar_header */
> >>
> Another way around this problem is to write another header foo_bar.tabb.h
> whose contents is
>    #ifndef foo_bar_header
>    #define foo_bar_header
>    #include "foo_bar.tab.h"
>    #endif /* foo_bar_header */
> Then, instead of foo_bar.tab.h, include the header foo_bar.tabb.h into your
> program.
That doesn't work: you need the _same_ declaration of YYSTYPE in the
class declaration _and_ in the implementation.

Regardless of the context in which I encounter this problem, the general
problem is: 

"If you include y.tab.h in the bison script (for whatever reason), you
get duplicate declarations on YYSTYPE".

Why not solve the problem as follows:

"If bison is invoked with the -d flag (requesting y.tab.h to be
generated), then #include "y.tab.h" in the generated y.tab.c file
instead of duplicating the declarations and generate y.tab.h wrapped in
proper conditionals avoiding duplicate inclusion."

This should be perfectly compatible with what bison generates now
without anyone having to change bison scripts (except when y.tab.h is
removed explicitly).


Philippe Bekaert
Post-doctoral Research Fellow
Max-Planck-Institut fuer Informatik
Im Stadtwald, Geb. 46.1
66123 Saarbruecken - Germany
+49 681 9325422 (office phone)
+49 681 9325499 (office fax)
+49 179 4503121 (private phone)

reply via email to

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