warnings: enable -Wuseless-cast, and eliminate warnings

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

* configure.ac (warn_cxx): Add -Wuseless-cast.
* data/skeletons/c.m4 (b4_attribute_define): Define
YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
* data/skeletons/glr.c (YY_FPRINTF): New, replaces YYFPRINTF, wrapped
with YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END.
(YY_DPRINTF): Likewise.
* tests/actions.at: Remove useless cast.
* tests/headers.at: Adjust.
This commit is contained in:
Akim Demaille
2019-11-30 09:23:35 +01:00
parent 9e9e49224f
commit f8d82ff039
7 changed files with 153 additions and 100 deletions

View File

@@ -326,7 +326,7 @@ AT_PERL_CHECK([[-n -0777 -e '
|YY_CONSTEXPR
|YY_COPY
|YY_CPLUSPLUS
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|YY_IGNORE_(?:MAYBE_UNINITIALIZED|USELESS_CAST)_(?:BEGIN|END)
|YY_INITIAL_VALUE
|YY_MOVE
|YY_MOVE_OR_COPY