help-bison
[Top][All Lists]
Advanced

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

User defined YYLTYPE with YYLTYPE_IS_TRIVIAL defined as 1


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.*


reply via email to

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