bug-bison
[Top][All Lists]
Advanced

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

Re: too many warnings from Bison CVS for Pike


From: Hans Aberg
Subject: Re: too many warnings from Bison CVS for Pike
Date: Tue, 14 Feb 2006 23:35:02 +0100

On 14 Feb 2006, at 22:24, Joel E. Denny wrote:

On Thu, 9 Feb 2006 address@hidden wrote:

Dynamic C-parserstack. This is what is Bison implements if
__cplusplus is not defined. However, this should work under C++ as
well for POD types. By the segment:

#if (! defined (yyoverflow) \
      && (! defined (__cplusplus) \
         || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
&& defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
   short int yyss;
   YYSTYPE yyvs;
     YYLTYPE yyls;
};
...

you already have a test against non-POD types, as these cannot be
used in a union. So if one would want to use this dynamic stack with
a POD type, just remove the (! defined (__cplusplus) above.

I'm getting a little lost in this thread, so forgive me if I'm
repeating.... Why is it necessary to remove the ! defined (__cplusplus)?
If %union is defined, then YYSTYPE_IS_TRIVIAL.  If also
YYLTYPE_IS_TRIVIAL, then union yyalloc and YYSTACK_RELOCATE() will be
defined.  In this case, defined(__cplusplus) is irrelevant.

Am I missing something?

If you say that if %union is invoked, and that defines YYSTYPE_IS_TRIVIAL, which in its turn causes the dynamic C- parserstack to be used, then I missed that. :-)

But one might supply a macro, say CPP_SEMANTIC_POD, which signals
that the C++ semantic type is a POD, and that the dynamic C-
parserstack should be used.

%union seems to be enough.

If %union using a C++ compiler automatically invokes the dynamic C- parserstack, then there would only be the need for such an option for user that want to use a POD type without %union.

But is not the combination of YYLTYPE_IS_TRIVIAL and YYSTYPE_IS_TRIVIAL the same as the macro CPP_SEMANTIC_POD I suggested? Why do you need two macros? Is not enough with one macro YYTYPES_ARE_POD, which, when defined, invoked the dynamic C-parser? Then %union defines YYTYPES_ARE_POD, triggering the dynamic stack. And if somebody defines YYTYPES_ARE_POD, and tries to put in a non- POD types in at least one of the semantic or location types, a conforming C++ compiler will generate an error message when it encounters the definition of union yyalloc above.

  Hans Aberg






reply via email to

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