[PATCH 0/5] maint: c++: fix several issues with assertions

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
All this started with Jot Dot's report about a C++ generated parser
hitting some line-length limitation of Visual C++:
https://lists.gnu.org/r/bug-bison/2020-11/msg00002.html

With this series of patches, we go from

#if 201103L <= YY_CPLUSPLUS
      symbol_type (int tok, location_type l)
        : super_type(token_type (tok), std::move (l))
      {
        YY_ASSERT (tok == token::TOK_YYEOF || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_ASSIGN || tok == token::TOK_MINUS || tok == token::TOK_PLUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN);
      }
#else
      symbol_type (int tok, const location_type& l)
        : super_type(token_type (tok), l)
      {
        YY_ASSERT (tok == token::TOK_YYEOF || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_ASSIGN || tok == token::TOK_MINUS || tok == token::TOK_PLUS || tok == token::TOK_STAR || tok == token::TOK_SLASH || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN);
      }
#endif

to

#if 201103L <= YY_CPLUSPLUS
      symbol_type (int tok, location_type l)
        : super_type(token_type (tok), std::move (l))
#else
      symbol_type (int tok, const location_type& l)
        : super_type(token_type (tok), l)
#endif
      {
        YY_ASSERT (tok == token::TOK_YYEOF
                   || (token::TOK_YYerror <= tok && tok <= token::TOK_RPAREN));
      }

I think we should soon release 3.7.4 with the current fixes (say this
weekend).  It would be most useful if people could give a try to the
current state of the maint branch, available here:

https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.3.15-f4e85.tar.gz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.3.15-f4e85.tar.lz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.3.15-f4e85.tar.xz

Thanks in advance.  Cheers!


Akim Demaille (5):
  c++: style: use more regular m4 quoting patterns
  c++: don't use YY_ASSERT at all if parse.assert is disabled
  lalr1.cc: YY_ASSERT should use api.prefix
  c++: don't glue functions together
  c++: shorten the assertions that check whether tokens are correct

 NEWS                      |  15 ++++
 data/skeletons/bison.m4   |   6 +-
 data/skeletons/c++.m4     |   5 +-
 data/skeletons/variant.hh | 142 +++++++++++++++++++++++++++-----------
 tests/headers.at          |  36 +++++++---
 tests/local.at            |   2 +-
 6 files changed, 150 insertions(+), 56 deletions(-)

-- 
2.29.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.