bug-bison
[Top][All Lists]
Advanced

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

EOF redefinition (3.5->3.6 error)


From: Egor Pugin
Subject: EOF redefinition (3.5->3.6 error)
Date: Thu, 11 Jun 2020 18:15:05 +0300

The code:
https://github.com/egorpugin/primitives/blob/master/src/version/src/range.ll#L74

The user macro:
https://github.com/egorpugin/primitives/blob/master/src/templates/include/primitives/helper/bison.h#L342

The error:
/Users/egor/.sw/storage/pkg/d2/69/81cc/src/sdir/src/version/src/range.ll:75:8:
error: no member named 'yy_range' in 'yy_range::parser::token'; did
you mean simply 'yy_range'?

return MAKE(EOQ);

       ^

/Users/egor/.sw/storage/pkg/52/12/6ff0/src/sdir/src/templates/include/primitives/helper/bison.h:342:18:
note: expanded from macro 'MAKE'

#define MAKE(x) {THIS_PARSER2::token::x, {}}

                 ^


The reason:
At the end of bison generated header there is
#undef EOQ
#define EOQ yy_range::parser::token::EOQ

Possible solutions for me:
1) #undef EOQ in flex file again (after bison undef)
2) Rewrite line from return MAKE(EOQ); to return EOQ;

The problem is that I have bison 3.5 on some systems and 3.6 on others.

Another solution I see is to put solution #2 under condition (#ifdef)
for bison 3.5 and 3.6, but it seems we do not have bison version macro
- this would be really useful.

Example from protobuf:
https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.pb.h#L11

So, we might have something generated in generated header/source files like
#define BISON_VERSION 30500 // 3.5.0
or
#define BISON_VERSION 30601 // 3.6.1

-- 
Egor Pugin



reply via email to

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