mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: fix old cast warnings
We still have a few old C casts in lalr1.cc, let's get rid of them. Reported by Frank Heckenbach. Actually, let's monitor all our casts using easy to grep macros. Let's use these macros to use the C++ standard casts when we are in C++. * data/skeletons/c.m4 (b4_cast_define): New. * data/skeletons/glr.c, data/skeletons/glr.cc, * data/skeletons/lalr1.cc, data/skeletons/stack.hh, * data/skeletons/yacc.c: Use it and/or its casts. * tests/actions.at, tests/cxx-type.at, * tests/glr-regression.at, tests/headers.at, tests/torture.at, * tests/types.at: Use YY_CAST instead of C casts. * configure.ac (warn_cxx): Add -Wold-style-cast. * doc/bison.texi: Disable it.
This commit is contained in:
@@ -174,6 +174,7 @@ m4_define([b4_shared_declarations],
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
]b4_cast_define[
|
||||
]b4_null_define[
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
@@ -1195,10 +1196,10 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
std::ptrdiff_t yylen = yyr2_[yyrule];
|
||||
// First pop from the LAC stack as many tokens as possible.
|
||||
std::ptrdiff_t lac_size = (std::ptrdiff_t) yylac_stack_.size ();
|
||||
std::ptrdiff_t lac_size = std::ptrdiff_t (yylac_stack_.size ());
|
||||
if (yylen < lac_size)
|
||||
{
|
||||
yylac_stack_.resize ((std::size_t) (lac_size - yylen));
|
||||
yylac_stack_.resize (std::size_t (lac_size - yylen));
|
||||
yylen = 0;
|
||||
}
|
||||
else if (lac_size)
|
||||
|
||||
Reference in New Issue
Block a user