diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-02-27 19:27:57 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-02-27 21:31:09 +0100 |
commit | 30d01b21e782d857d16e0a24a59506bca05e298f (patch) | |
tree | 2d6141a29c8d34f93cc20191a76a10770e2b4ad4 | |
parent | c2cca4679515e2d24363d7252fcf1b8f09ccff11 (diff) | |
download | bison-30d01b21e782d857d16e0a24a59506bca05e298f.tar.gz |
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.
-rw-r--r-- | data/skeletons/lalr1.cc | 43 | ||||
-rw-r--r-- | src/parse-gram.c | 4 | ||||
-rw-r--r-- | src/parse-gram.h | 2 |
3 files changed, 25 insertions, 24 deletions
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 8896a95d..91b08a12 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -236,25 +236,26 @@ m4_define([b4_shared_declarations], ]b4_token_constructor_define[ ]b4_parse_error_bmatch([custom\|detailed\|verbose], [[ - class context { - public: - context (const ]b4_parser_class[& yyparser, symbol_type yyla) - : yyparser (yyparser) - , yyla (yyla) - {} + class context + { + public: + context (const ]b4_parser_class[& yyparser, symbol_type yyla) + : yyparser_ (yyparser) + , yyla_ (yyla) + {} ]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 - number of tokens stored in YYARG. If YYARG is null, return the - number of expected tokens (guaranteed to be less than YYNTOKENS). */ - int yyexpected_tokens (int yyarg[], int yyargn) const; + /* 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 expected tokens (guaranteed to be less than YYNTOKENS). */ + 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: - const ]b4_parser_class[& yyparser; - symbol_type yyla; + private: + const ]b4_parser_class[& yyparser_; + symbol_type yyla_; }; ]])[ private: @@ -1236,12 +1237,12 @@ b4_dollar_popdef])[]dnl #if ]b4_api_PREFIX[DEBUG // Execute LAC once. We don't care if it is successful, we // only do it for the sake of debugging output. - if (!yyparser.yy_lac_established_) - yyparser.yy_lac_check_ (yyla.type_get ()); + if (!yyparser_.yy_lac_established_) + yyparser_.yy_lac_check_ (yyla_.type_get ()); #endif 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) ++yycount; @@ -1251,7 +1252,7 @@ b4_dollar_popdef])[]dnl yyarg[yycount++] = yyx; } ]], [[ - int yyn = yypact_[yyparser.yystack_[0].state]; + int yyn = yypact_[+yyparser_.yystack_[0].state]; if (!yy_pact_value_is_default_ (yyn)) { /* 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.]])[ */ - 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); return yyn + 1; } diff --git a/src/parse-gram.c b/src/parse-gram.c index 0ca7a566..2d4c8a30 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.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 implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.2" +#define YYBISON_VERSION "3.5.2.140-15e57-dirty" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" diff --git a/src/parse-gram.h b/src/parse-gram.h index e07ce98b..de7fd498 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -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 |