mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Avoid compiler warnings
At least GCC 7.3, with -O1 or -O2 (but not -O0 or -O3) generates warnings with -Wnull-dereference when using yyformat: it fails to see yyformat cannot be null. Reported by Frank Heckenbach, https://savannah.gnu.org/patch/?9620. * configure.ac: Use -Wnull-dereference if supported. * data/glr.c, data/lalr1.cc, data/yacc.c: Define yyformat in such a way that GCC cannot not see that yyformat is defined. Using `default: abort();` also addresses the issue, but forces the inclusion of `stdlib.h`, which we avoid.
This commit is contained in:
@@ -82,7 +82,7 @@ AC_ARG_ENABLE([gcc-warnings],
|
||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
|
||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||
warn_cxx='-Wnoexcept'
|
||||
# Warnings for the test suite only.
|
||||
|
||||
Reference in New Issue
Block a user