bison-patches
[Top][All Lists]
Advanced

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

tests: disable GCC7 warnings for some tests


From: Akim Demaille
Subject: tests: disable GCC7 warnings for some tests
Date: Sun, 2 Sep 2018 18:21:31 +0200

I’m surprised we still have warnings in the test suite,
I believed I had checked GCC7 with Bison 3.1.

commit d87c8ac79ab844d6a7a4f5103dcf7a842d18b611
Author: Akim Demaille <address@hidden>
Date:   Sun Sep 2 18:15:55 2018 +0200

    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 9645a2b20ee7cbfa8bb4ac2237f87d598afe349c.
    
    * 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.

diff --git a/tests/headers.at b/tests/headers.at
index 93b70b73..541610db 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -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[
 %}
diff --git a/tests/local.at b/tests/local.at
index 5341549e..035d7cfd 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -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])




reply via email to

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