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:
@@ -1077,6 +1077,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: // Avoid compiler warnings.
|
||||
YYCASE_ (0, YY_("syntax error"));
|
||||
YYCASE_ (1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
|
||||
Reference in New Issue
Block a user