bison-patches
[Top][All Lists]
Advanced

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

yacc: beware of GCC9 warnings in push mode


From: Akim Demaille
Subject: yacc: beware of GCC9 warnings in push mode
Date: Sun, 20 Oct 2019 14:04:26 +0200

commit c30c6b651973da07f3b28f23c3e4ff5f69f32082
Author: Akim Demaille <address@hidden>
Date:   Sun Oct 20 13:55:36 2019 +0200

    yacc: beware of GCC9 warnings in push mode
    
        260. headers.at:184: testing Sane headers: api.pure api.push-pull=both 
...
        tests/headers.at:184: COLUMNS=1000; export COLUMNS;  bison --color=no 
-fno-caret -d -o input.c input.y
        tests/headers.at:184: $CC $CFLAGS $CPPFLAGS  -c -o input.o input.c
        stderr:
        input.c: In function 'yyparse':
        input.c:1276:16: error: 'yylval' may be used uninitialized in this 
function [-Werror=maybe-uninitialized]
         1276 |         yylval = *yypushed_val;
              |         ~~~~~~~^~~~~~~~~~~~~~~
        input.c: In function 'yypull_parse':
        input.c:1276:16: error: 'yylval' may be used uninitialized in this 
function [-Werror=maybe-uninitialized]
         1276 |         yylval = *yypushed_val;
              |         ~~~~~~~^~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        stdout:
        tests/headers.at:184: exit code was 1, expected 0
    
    * data/skeletons/yacc.c (yybackup:): Silence this warning.

diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 18e40fc2..5bcd8fb0 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1586,7 +1586,9 @@ yybackup:
          yypush_parse invocation since subsequent invocations don't overwrite
          it before jumping to yyread_pushed_token.  */
       yychar = yypushed_char;
-      yylval = yypushed_val;]b4_locations_if([[
+      YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+      yylval = yypushed_val;
+      YY_IGNORE_MAYBE_UNINITIALIZED_END]b4_locations_if([[
       yylloc = yypushed_loc;]])])[
 yyread_pushed_token:]])[
       YYDPRINTF ((stderr, "Reading a token: "));]b4_push_if([b4_pure_if([[




reply via email to

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