mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
c++: please G++ 4.8 with -O3: array bounds
* data/c++.m4, data/lalr1.cc (by_state, by_type): Do not use -1 to denote the absence of value, as GCC then fears that this -1 might be used to dereference arrays (such as yytname). Use 0, which corresponds to $accept, which is valueless (the needed property: the symbol destructor must not try to reclaim the memory associated with the symbol).
This commit is contained in:
@@ -231,6 +231,8 @@ m4_define([b4_public_types_declare],
|
||||
/// The token.
|
||||
token_type token () const;
|
||||
|
||||
enum { empty = 0 };
|
||||
|
||||
/// The symbol type.
|
||||
///
|
||||
/// -1 when this symbol is empty.
|
||||
@@ -328,7 +330,7 @@ m4_define([b4_public_types_define],
|
||||
// by_type.
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type ()
|
||||
: type (-1)
|
||||
: type (empty)
|
||||
{}
|
||||
|
||||
inline
|
||||
@@ -346,7 +348,7 @@ m4_define([b4_public_types_define],
|
||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||
{
|
||||
type = that.type;
|
||||
that.type = -1;
|
||||
that.type = empty;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user