bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: master: c++: fix GCC8 warnings about uninitialized values


From: Akim Demaille
Subject: Re: FYI: master: c++: fix GCC8 warnings about uninitialized values
Date: Thu, 23 Aug 2018 13:36:43 +0200

Hi Paul,

> Le 19 août 2018 à 12:13, Akim Demaille <address@hidden> a écrit :
> 
>> Le 19 août 2018 à 11:05, Paul Eggert <address@hidden> a écrit :
>> 
>> Could you please send me these .c files as attachments? That way, I won't 
>> have to reproduce the exact version of bison you're using. Thanks.
> 
> I did.  Our mailers don’t like each other I guess :)
> 
> https://lists.gnu.org/archive/html/bison-patches/2018-08/msg00084.html

I installed this, so that we are not blocked for 3.1.

commit 9d6db38f9c946182a1755c3c6c1bad6534b04eb7
Author: Akim Demaille <address@hidden>
Date:   Thu Aug 23 08:55:33 2018 +0200

    tests: disable -Wmaybe-uninitialized in some tests
    
    On these tests, at -O2 and above, GCC 8 complains that yylval may be
    uninitialized.  But it seems wrong: it is initialized.  Rather than
    turning off the warning in the skeleton (hence possibility hiding
    relevant warnings of user parsers), let's turn it off in the tests
    only.
    
        163: parse.error=verbose and consistent errors:      FAILED 
(conflicts.at:625)
        165: parse.error=verbose and consistent errors: 
lr.default-reduction=consistent FAILED (conflicts.at:635)
        166: parse.error=verbose and consistent errors: 
lr.default-reduction=accepting FAILED (conflicts.at:641)
        167: parse.error=verbose and consistent errors: lr.type=canonical-lr 
FAILED (conflicts.at:645)
        168: parse.error=verbose and consistent errors: parse.lac=full FAILED 
(conflicts.at:650)
        169: parse.error=verbose and consistent errors: parse.lac=full 
lr.default-reduction=accepting FAILED (conflicts.at:655)
    
    We get:
    
        input.c: In function 'yyparse':
        input.c:980:9: error: 'yylval' may be used uninitialized in this 
function [-Werror=maybe-uninitialized]
         YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
                 ^~~~~~
        cc1: all warnings being treated as errors
    
    See https://lists.gnu.org/archive/html/bison-patches/2018-08/msg00063.html.
    
    * tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Disable
    -Wmaybe-uninitialized.

diff --git a/tests/conflicts.at b/tests/conflicts.at
index bf053b86..31eedb66 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -394,6 +394,10 @@ AT_CLEANUP
 ## parse.error=verbose and consistent errors.  ##
 ## ------------------------------------------- ##
 
+AT_CONSISTENT_ERRORS_CHECK([BISON-DIRECTIVE],
+                           [GRAMMAR],
+                           [INPUT],
+                           [UNEXPECTED-TOKEN], [EXPECTED-TOKEN])
 m4_pushdef([AT_CONSISTENT_ERRORS_CHECK], [
 
 AT_SETUP([[parse.error=verbose and consistent errors: ]$1])
@@ -422,6 +426,14 @@ AT_SKEL_JAVA_IF([AT_DATA], [AT_DATA_GRAMMAR])([input.y],
 
 ]AT_SKEL_CC_IF([[%defines]], [[%define api.pure]])])[
 
+]AT_YACC_IF([[
+%code {
+  #if defined __GNUC__ && 8 <= __GNUC__
+  # pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+  #endif
+}
+]])[
+
 ]$1[
 
 %define parse.error verbose




reply via email to

[Prev in Thread] Current Thread [Next in Thread]