c++: remove useless cast about yyeof_

Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html

* data/skeletons/c++.m4 (b4_yytranslate_define): Don't use yyeof_ as
if it had two different types.
It is used once against the input argument, which is the value
returned by yylex, which is an "external token number", typically an
int.  It is also used as output type, an "internal symbol number".
It turns out that in both cases we mean "0", but let's keep yyeof_
only for the case "internal symbol number", i.e., _after_ conversion
by yytranslate.
This frees us from one cast.
This commit is contained in:
Akim Demaille
2019-11-30 16:52:48 +01:00
parent 9471a5ffe9
commit a4bf7cdf9e

View File

@@ -545,7 +545,7 @@ m4_define([b4_yytranslate_define],
const int user_token_number_max_ = ]b4_user_token_number_max[; const int user_token_number_max_ = ]b4_user_token_number_max[;
const token_number_type undef_token_ = ]b4_undef_token_number[; const token_number_type undef_token_ = ]b4_undef_token_number[;
if (static_cast<int> (t) <= yyeof_) if (t <= 0)
return yyeof_; return yyeof_;
else if (static_cast<int> (t) <= user_token_number_max_) else if (static_cast<int> (t) <= user_token_number_max_)
return translate_table[t]; return translate_table[t];