help-bison
[Top][All Lists]
Advanced

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

Re: User defined YYLTYPE with YYLTYPE_IS_TRIVIAL defined as 1


From: Debashis De
Subject: Re: User defined YYLTYPE with YYLTYPE_IS_TRIVIAL defined as 1
Date: Mon, 3 Apr 2017 08:40:57 +0530

Thanks for your reply.

I tried to add the %initial-action block as you suggested but that does not
stop the warning.
Undefining YYLTYPE_IS_TRIVIAL stops the warning.


On Sat, Apr 1, 2017 at 1:00 AM, Gabriel Czernikier <address@hidden>
wrote:

> The following could be placed anywhere in your declarations section
> (before the first occurrence of "%%"):
>
> %initial-action
> {
> @$.member_1 = 1;
> @$.member_2 = 1;
> ...
> @$.member_6 = 1;
> };
>
> The YYLTYPE_IS_TRIVIAL is probably better not to be arround.
>
> Regards,
> Gabriel
>
> ------------------------------
> *From*: Debashis De
> *Subject*: User defined YYLTYPE with YYLTYPE_IS_TRIVIAL defined as 1
> *Date*: Fri, 31 Mar 2017 11:03:52 +0530
> ------------------------------
>
> Hi,
>
>     I have (re)defined YYLTYPE and added two more members after the usual
> first line/col and last line/col. So, I have 6 unsigned fields in YYLTYPE.
> I have also defined YYLTYPE_IS_TRIVIAL as 1.
>
>     Now, Bison 3.0.4 generates the following code:
> /* Location data for the lookahead symbol.  */
> YYLTYPE yylloc
> # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
>   = { 1, 1, 1, 1 }
> # endif
> ;
>
>     As you can see, it only initializes the default 4 members and not the
> two new one I added. For this, g++ 4.7.2 produces compiler warning:
> "missing initializer for member ...".
>
>     Does anyone know how can I initialize yylloc myself and include the
> initialization for all the members?
>
> Thanks and regards,
> Debashis
>
> --
> *Things are to be used, people are to be loved. Do not do it the other way
> round.*
>
>
>


-- 
*Things are to be used, people are to be loved. Do not do it the other way
round.*


reply via email to

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