tests: disable GCC7 warnings for some tests

With GCC7 we have warnings (false positive):

    x8.c: In function 'x8_parse':
    x8.c:1233:16: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             yylval = *yypushed_val;
             ~~~~~~~^~~~~~~~~~~~~~~
    x8.c: In function 'x8_pull_parse':
    x8.c:1233:16: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             yylval = *yypushed_val;
             ~~~~~~~^~~~~~~~~~~~~~~

See also 9645a2b20e.

* tests/local.at (AT_PUSH_IF): New.
(AT_BISON_OPTION_POPDEFS): Pop it, and pop AT_PURE_IF.
* tests/headers.at (Several parsers, Several parsers): Disable these
warnings when in push parser.
This commit is contained in:
Akim Demaille
2018-09-02 18:15:55 +02:00
parent a7e46f6e41
commit d87c8ac79a
2 changed files with 16 additions and 4 deletions

View File

@@ -111,8 +111,8 @@ AT_CLEANUP
## Sane headers. ##
## -------------- ##
# AT_TEST([DIRECTIVES])
# ---------------------
# AT_TEST([DIRECTIVES], [COMPILER-FLAGS])
# ---------------------------------------
# Check that headers are self-contained and protected againt multiple
# inclusions.
@@ -125,7 +125,11 @@ AT_DATA_GRAMMAR([input.y],
%error-verbose
]AT_VARIANT_IF([], [%union {int integer;}])[
%code {
#include <stdio.h>
]AT_PUSH_IF([[
#if defined __GNUC__ && 7 == __GNUC__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
]])[
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
}
@@ -206,7 +210,11 @@ $2
int integer;
}
%{
#include <stdio.h>
]AT_PUSH_IF([[
#if defined __GNUC__ && 7 == __GNUC__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
]])[
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
%}

View File

@@ -180,6 +180,8 @@ m4_pushdef([AT_PURE_IF],
[m4_bmatch([$3], [%define *api\.pure\|%pure-parser],
[m4_bmatch([$3], [%define *api\.pure *false], [$2], [$1])],
[$2])])
m4_pushdef([AT_PUSH_IF],
[m4_bmatch([$3], [%define api.push-pull \(both\|pull\)], [$1], [$2])])
# AT_NAME_PREFIX: also consider api.namespace.
m4_pushdef([AT_NAME_PREFIX],
[m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) .*],
@@ -299,6 +301,8 @@ m4_popdef([AT_NAME_PREFIX])
m4_popdef([AT_LOCATION_TYPE_IF])
m4_popdef([AT_LOCATION_IF])
m4_popdef([AT_PARSE_PARAMS])
m4_popdef([AT_PUSH_IF])
m4_popdef([AT_PURE_IF])
m4_popdef([AT_PARAM_IF])
m4_popdef([AT_LEXPARAM_IF])
m4_popdef([AT_YACC_IF])