[Top][All Lists]

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

Re: Bison HEAD failure on RHEL 7.7

From: Akim Demaille
Subject: Re: Bison HEAD failure on RHEL 7.7
Date: Thu, 10 Oct 2019 17:52:56 +0200

Hi Paul,

Here's my take on this issue.  Could you please try it?  I've not installed it 
(but it's in the rhel branch).

commit bfa6cc27c018d538566f18125263f4b1dd57b423
Author: Akim Demaille <address@hidden>
Date:   Wed Oct 9 09:10:57 2019 +0200

    tests: do not depend on config.h
    Currently we face test suite failures in different environments,
    because of a conflict between the definitions of isnan by gnulib, and
    by the C++ library:
        262. headers.at:186: testing Sane headers: %locations %debug c++ ...
        ./headers.at:186: COLUMNS=1000; export COLUMNS;  bison --color=no 
-fno-caret -d -o input.cc input.y
        ./headers.at:186: $CXX $CXXFLAGS $CPPFLAGS  -c -o input.o input.cc
        In file included from /usr/include/c++/4.8.2/cmath:44:0,
                         from /usr/include/c++/4.8.2/random:38,
                         from /usr/include/c++/4.8.2/bits/stl_algo.h:65,
                         from /usr/include/c++/4.8.2/algorithm:62,
                         from location.hh:41,
                         from input.hh:90,
                         from input.cc:50:
        /u/cs/fac/eggert/src/gnu/bison/lib/math.h: In function 'bool 
        /u/cs/fac/eggert/src/gnu/bison/lib/math.h:2849:1: error: new 
declaration 'bool isnan(double)'
         _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
        In file included from /usr/include/features.h:375:0,
                         from /usr/include/c++/4.8.2/cstdlib:41,
                         from input.hh:48,
                         from input.cc:50:
        /usr/include/bits/mathcalls.h:235:1: error: ambiguates old declaration 
'int isnan(double)'
         __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ 
    There might be something to do in gnulib about this, but I believe
    that gnulib should not be used in the test suite in the first place.
    The test suite should work with other compilers than the one used to
    compile the package.  For a start, Bison sources are more
    demanding (C99) than the generated parsers.  Last time I tried, tcc
    for example, was not able to compile Bison, yet our generated parsers
    should compile cleanly with it.
    Besides the problem at hand is with the C++ compiler, with is not the
    one used to set up gnulib at configuration-time (config.h is mainly
    built from probing the C compiler).
    We should really not depend on gnulib in tests.
    This was introduced in 2001 to check whether including
    stdlib.h/string.h is safe thanks to STDC_HEADERS
    (2ce1014469742b5c6618daf8506b69e38787c7d5).  Today, we assume at least
    a C90 compiler, it should be safe enough.
    * tests/local.at, tests/testsuite.h: Do not include config.h.
    * tests/atlocal.in (conftest.cc): Likewise.
    (CPPFLAGS): Do not expose lib/, as because of this we might picked up
    gnulib replacement headers for system headers.
    * tests/input.at: Use int instead of ptrdiff_t, for easier portability
    (some machine on the CI did not find ptrdiff_t).
    * tests/c++.at: Add missing include for getchar.

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 471a2980..1a2e4613 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -16,9 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-# We need 'testsuite.h' (srcdir/test), 'config.h' (builddir/lib), and
-# the gnulib headers (srcdir/lib).
-CPPFLAGS="-I$abs_top_srcdir/tests -I$abs_top_srcdir/lib 
-I$abs_top_builddir/lib @CPPFLAGS@"
+# We need 'testsuite.h' (srcdir/test).
+CPPFLAGS="-I$abs_top_srcdir/tests @CPPFLAGS@"
 # Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
 # as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
@@ -73,11 +72,7 @@ fi
 if $BISON_CXX_WORKS; then
   cat >conftest.cc <<EOF
-#include <config.h>
-/* We don't need perfect functions for these tests. */
-#undef malloc
-#undef memcmp
-#undef realloc
+#include <testsuite.h>
 #include <iostream>
 int main ()
diff --git a/tests/c++.at b/tests/c++.at
index 2224c7b7..be9fa10a 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -988,7 +988,8 @@ yy::parser::error (const std::string &m)
 # Another file to check syntax_error's linkage.
-[[#include "input.hh"
+[[#include <cstdio>  // getchar
+#include "input.hh"
 // 'a': valid item, 's': syntax error, 'l': lexical error.
diff --git a/tests/input.at b/tests/input.at
index 976e5395..e77ae90c 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1322,7 +1322,7 @@ yylex (void)
   enum { input_elts = sizeof input };
   (void) input_elts;
-  static ptrdiff_t toknum;
+  static int toknum;
   assert (0 <= toknum && toknum < input_elts);
   yylval = value_as_yystype (input[toknum]);
   return input[toknum++];
diff --git a/tests/local.at b/tests/local.at
index d8811b0e..24899352 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -388,7 +388,7 @@ m4_define([AT_LANG_DISPATCH],
 # The prologue that should be included in any source code that is
 # meant to be compiled.  Keep atlocal.in sync (BISON_CXX_WORKS).
-[[/* Load config.h, and adjust to the compiler.
+[[/* Adjust to the compiler.
   We used to do it here, but each time we add a new line,
   we have to adjust all the line numbers in error messages.
   It's simpler to use a constant include to a varying file.  */
diff --git a/tests/testsuite.h b/tests/testsuite.h
index e4c8298d..3a2a3626 100644
--- a/tests/testsuite.h
+++ b/tests/testsuite.h
@@ -1,4 +1,3 @@
-#include <config.h>
 /* We don't need perfect functions for these tests. */
 #undef malloc
 #undef memcmp

reply via email to

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