summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-11-30 09:23:35 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-12-06 08:27:55 +0100
commitf8d82ff03900c109efb57634299d7d180ce60987 (patch)
tree2b3a125b22ed6faa1e3823f10420092587fc95d3 /configure.ac
parent9e9e49224fb4a7fae7b98205e1165fbfcea2453f (diff)
downloadbison-f8d82ff03900c109efb57634299d7d180ce60987.tar.gz
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac10
1 files changed, 8 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 45f87370..7a80eac1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,8 +151,6 @@ if test "$enable_gcc_warnings" = yes; then
# Warnings for the test suite, and maybe for bison if GCC is modern
# enough.
- gl_WARN_ADD([-Wmissing-declarations], [WARN_CFLAGS_TEST])
- gl_WARN_ADD([-Wmissing-prototypes], [WARN_CFLAGS_TEST])
test $lv_cv_gcc_pragma_push_works = yes &&
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
@@ -179,6 +177,14 @@ if test "$enable_gcc_warnings" = yes; then
[[if (sizeof (long) < sizeof (int)) return 1;]])])
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
[AC_LANG_PROGRAM([], [nullptr])])
+ # Before GCC6, the pragmas don't work well enough to neutralize
+ # this warning.
+ gl_WARN_ADD([-Wuseless-cast], [WARN_CXXFLAGS],
+ [AC_LANG_PROGRAM([], [
+ #if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6
+ syntax error
+ #endif
+ ])])
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
# Warnings for the test suite only.
for i in $warn_tests;