bison-patches
[Top][All Lists]
Advanced

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

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


From: Akim Demaille
Subject: [PATCH 0/5] maint: c++: fix several issues with assertions
Date: Wed, 11 Nov 2020 16:39:45 +0100

All this started with Jot Dot's report about a C++ generated parser
hitting some length limitation of Visual C++:
https://lists.gnu.org/r/bug-bison/2020-11/msg00002.html

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




reply via email to

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