bug-bison
[Top][All Lists]
Advanced

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

Re: yacc.c does not prototype yyparse in the header


From: Paul Eggert
Subject: Re: yacc.c does not prototype yyparse in the header
Date: Tue, 12 Jun 2012 09:41:09 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 06/12/2012 06:54 AM, Akim Demaille wrote:
> First, there are no CPP guards used in our generated headers
> (for yacc.c).  I would very much like them to have some, especially
> because in some cases it might help us simplify some of the "inner"
> guards we have (to avoid multiple definitions of the same
> typedefs for instance).

Sure, that makes sense.

> Second, I never really paid attention to this before,
> but how on earth can it be really useful to rename the
> global variables (--name-prefix) such as yylval, global
> functions, such as yyparse, but not the global types, such as
> YYSTYPE?

This "works" because different modules can include different
parser.h files.  So long as no single module includes both
parser.h files, there is no clash at compile-time; and there
is no clash at link-time because types are invisible to the
linker.  But it clearly would be better to do as you suggest
and to apply the prefix to the types as well -- that
would support programs where a single module wants to include
two parser.h files (something that does not work now).



reply via email to

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