mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 03:03:02 +00:00
c++: minor fixes
Address compiler warnings such as
warning: declaration of 'yyla' shadows a member of 'yy::parser::context' [-Wshadow]
* data/skeletons/lalr1.cc (context): Don't use the same names for
variables and members.
Use foo_ for private members, as in parser.
Also, use the + trick in array accesses to please ICC and provide it
with an int.
This commit is contained in:
@@ -236,25 +236,26 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
]b4_token_constructor_define[
|
]b4_token_constructor_define[
|
||||||
]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
|
]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
|
||||||
class context {
|
class context
|
||||||
public:
|
{
|
||||||
context (const ]b4_parser_class[& yyparser, symbol_type yyla)
|
public:
|
||||||
: yyparser (yyparser)
|
context (const ]b4_parser_class[& yyparser, symbol_type yyla)
|
||||||
, yyla (yyla)
|
: yyparser_ (yyparser)
|
||||||
{}
|
, yyla_ (yyla)
|
||||||
|
{}
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
const location_type& location () const { return yyla.location; }
|
const location_type& location () const { return yyla_.location; }
|
||||||
]])[
|
]])[
|
||||||
/* Put in YYARG at most YYARGN of the expected tokens, and return the
|
/* Put in YYARG at most YYARGN of the expected tokens, and return the
|
||||||
number of tokens stored in YYARG. If YYARG is null, return the
|
number of tokens stored in YYARG. If YYARG is null, return the
|
||||||
number of expected tokens (guaranteed to be less than YYNTOKENS). */
|
number of expected tokens (guaranteed to be less than YYNTOKENS). */
|
||||||
int yyexpected_tokens (int yyarg[], int yyargn) const;
|
int yyexpected_tokens (int yyarg[], int yyargn) const;
|
||||||
|
|
||||||
int yysyntax_error_arguments (int yyarg[], int yyargn) const;
|
int yysyntax_error_arguments (int yyarg[], int yyargn) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ]b4_parser_class[& yyparser;
|
const ]b4_parser_class[& yyparser_;
|
||||||
symbol_type yyla;
|
symbol_type yyla_;
|
||||||
};
|
};
|
||||||
]])[
|
]])[
|
||||||
private:
|
private:
|
||||||
@@ -1236,12 +1237,12 @@ b4_dollar_popdef])[]dnl
|
|||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
// Execute LAC once. We don't care if it is successful, we
|
// Execute LAC once. We don't care if it is successful, we
|
||||||
// only do it for the sake of debugging output.
|
// only do it for the sake of debugging output.
|
||||||
if (!yyparser.yy_lac_established_)
|
if (!yyparser_.yy_lac_established_)
|
||||||
yyparser.yy_lac_check_ (yyla.type_get ());
|
yyparser_.yy_lac_check_ (yyla_.type_get ());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
||||||
if (yyx != yy_error_token_ && yyx != yy_undef_token_ && yyparser.yy_lac_check_ (yyx))
|
if (yyx != yy_error_token_ && yyx != yy_undef_token_ && yyparser_.yy_lac_check_ (yyx))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
++yycount;
|
++yycount;
|
||||||
@@ -1251,7 +1252,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyarg[yycount++] = yyx;
|
yyarg[yycount++] = yyx;
|
||||||
}
|
}
|
||||||
]], [[
|
]], [[
|
||||||
int yyn = yypact_[yyparser.yystack_[0].state];
|
int yyn = yypact_[+yyparser_.yystack_[0].state];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
@@ -1311,9 +1312,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
accepted due to an error action in a later state.]])[
|
accepted due to an error action in a later state.]])[
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!yyla.empty ())
|
if (!yyla_.empty ())
|
||||||
{
|
{
|
||||||
yyarg[0] = yyla.type_get ();
|
yyarg[0] = yyla_.type_get ();
|
||||||
int yyn = yyexpected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
int yyn = yyexpected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
||||||
return yyn + 1;
|
return yyn + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.2. */
|
/* A Bison parser, made by GNU Bison 3.5.2.140-15e57-dirty. */
|
||||||
|
|
||||||
/* Bison implementation for Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "3.5.2"
|
#define YYBISON_VERSION "3.5.2.140-15e57-dirty"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.2. */
|
/* A Bison parser, made by GNU Bison 3.5.2.140-15e57-dirty. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user