warnings: pacify ‘gcc -Wchar-subscripts’ in yacc.c

Problem reported by Andy Fiddaman in:
https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html
* data/skeletons/yacc.c (yy_reduce_print, yy_lac, yysyntax_error)
(yyreturn): If I might be a char, write a[+I] instead of a[I],
so that ‘gcc -Wchar-subscripts’ does not complain.
This commit is contained in:
Paul Eggert
2019-12-18 13:34:57 -08:00
parent 0d73c39bb7
commit 139d065594

View File

@@ -755,7 +755,7 @@ do { \
{ {
YYFPRINTF (stderr, " $%d = ", yyi + 1); YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]], yystos[+yyssp[yyi + 1 - yynrhs]],
&]b4_rhs_value(yynrhs, yyi + 1)[ &]b4_rhs_value(yynrhs, yyi + 1)[
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
b4_user_args[); b4_user_args[);
@@ -955,12 +955,12 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
} }
while (1) while (1)
{ {
int yyrule = yypact[*yyesp]; int yyrule = yypact[+*yyesp];
if (yypact_value_is_default (yyrule) if (yypact_value_is_default (yyrule)
|| (yyrule += yytoken) < 0 || YYLAST < yyrule || (yyrule += yytoken) < 0 || YYLAST < yyrule
|| yycheck[yyrule] != yytoken) || yycheck[yyrule] != yytoken)
{ {
yyrule = yydefact[*yyesp]; yyrule = yydefact[+*yyesp];
if (yyrule == 0) if (yyrule == 0)
{ {
YYDPRINTF ((stderr, " Err\n")); YYDPRINTF ((stderr, " Err\n"));
@@ -1184,7 +1184,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
*/ */
if (yytoken != YYEMPTY) if (yytoken != YYEMPTY)
{ {
int yyn = yypact[*yyssp]; int yyn = yypact[+*yyssp];
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
yysize = yysize0;]b4_lac_if([[ yysize = yysize0;]b4_lac_if([[
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[ YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
@@ -1940,7 +1940,7 @@ yyreturn:
while (yyssp != yyss) while (yyssp != yyss)
{ {
yydestruct ("Cleanup: popping", yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[); yystos[+*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
YYPOPSTACK (1); YYPOPSTACK (1);
} }
#ifndef yyoverflow #ifndef yyoverflow