>From beceb2fa9382fd44816cae382dd12ffc6a210d5e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Oct 2019 11:49:56 -0700 Subject: [PATCH 1/2] Work around GCC 4.8 false alarms without casts * data/skeletons/yacc.c (yyparse): Initialize yyes_capacity with a signed expression. * tests/local.at (AT_YYLEX_DEFINE(c)): Use enum to avoid cast. --- TODO | 8 -------- data/skeletons/yacc.c | 2 +- tests/local.at | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 0a02ff03..a5935029 100644 --- a/TODO +++ b/TODO @@ -117,14 +117,6 @@ compiling yacc.c code: YYPTRDIFF_T yysize = (YYPTRDIFF_T) (yyesp - *yyes + 1); -Or G++ 4.8 - - yyes_capacity = (YYPTRDIFF_T) (sizeof yyesa / sizeof *yyes); - -Or GCC 4.8 - - int input_elts = (int) (sizeof input / sizeof input[0]); - * Completion Several features are not available in all the backends. diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index abe20a5f..5ef4289e 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -1490,7 +1490,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[ yystacksize = YYINITDEPTH;]b4_lac_if([[ yyes = yyesa; - yyes_capacity = (YYPTRDIFF_T) (sizeof yyesa / sizeof *yyes); + yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[; if (YYMAXDEPTH < yyes_capacity) yyes_capacity = YYMAXDEPTH;]])[ diff --git a/tests/local.at b/tests/local.at index 579b85c3..3acb2791 100644 --- a/tests/local.at +++ b/tests/local.at @@ -558,7 +558,7 @@ static static int toknum = 0; int res; ]AT_USE_LEX_ARGS[ - int input_elts = (int) (sizeof input / sizeof input[0]); + enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; -- 2.17.1