>From 693e6631d5eaee0f82b72468787f65f4b433511e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 18 Dec 2019 13:34:57 -0800 Subject: [PATCH] =?UTF-8?q?warnings:=20pacify=20=E2=80=98gcc=20-Wchar-subs?= =?UTF-8?q?cripts=E2=80=99=20in=20yacc.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- data/skeletons/yacc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index 2830c1de..0fb9db0f 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -755,7 +755,7 @@ do { \ { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], + yystos[+yyssp[yyi + 1 - yynrhs]], &]b4_rhs_value(yynrhs, yyi + 1)[ ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl b4_user_args[); @@ -955,12 +955,12 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes, } while (1) { - int yyrule = yypact[*yyesp]; + int yyrule = yypact[+*yyesp]; if (yypact_value_is_default (yyrule) || (yyrule += yytoken) < 0 || YYLAST < yyrule || yycheck[yyrule] != yytoken) { - yyrule = yydefact[*yyesp]; + yyrule = yydefact[+*yyesp]; if (yyrule == 0) { YYDPRINTF ((stderr, " Err\n")); @@ -1184,7 +1184,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; + int yyn = yypact[+*yyssp]; YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); yysize = yysize0;]b4_lac_if([[ YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[ @@ -1940,7 +1940,7 @@ yyreturn: while (yyssp != yyss) { 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); } #ifndef yyoverflow -- 2.23.0