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.
This commit is contained in:
Akim Demaille
2018-08-23 08:55:33 +02:00
parent 7ff6b7bbca
commit 9645a2b20e

View File

@@ -394,6 +394,10 @@ AT_CLEANUP
## parse.error=verbose and consistent errors. ## ## parse.error=verbose and consistent errors. ##
## ------------------------------------------- ## ## ------------------------------------------- ##
AT_CONSISTENT_ERRORS_CHECK([BISON-DIRECTIVE],
[GRAMMAR],
[INPUT],
[UNEXPECTED-TOKEN], [EXPECTED-TOKEN])
m4_pushdef([AT_CONSISTENT_ERRORS_CHECK], [ m4_pushdef([AT_CONSISTENT_ERRORS_CHECK], [
AT_SETUP([[parse.error=verbose and consistent errors: ]$1]) 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_SKEL_CC_IF([[%defines]], [[%define api.pure]])])[
]AT_YACC_IF([[
%code {
#if defined __GNUC__ && 8 <= __GNUC__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
}
]])[
]$1[ ]$1[
%define parse.error verbose %define parse.error verbose