diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-10-09 09:10:57 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-10-10 17:53:48 +0200 |
commit | f41e0cf73cba064f828ae3faa32cbd55ad15d19a (patch) | |
tree | fc8aae3b427daf0ac5da974237cd82d8de538016 /tests/local.at | |
parent | d6ce0521cfb10a155aa274882dea58593ed435af (diff) | |
download | bison-f41e0cf73cba064f828ae3faa32cbd55ad15d19a.tar.gz |
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
stderr:
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 isnan(double)':
/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/x86_64-redhat-linux/bits/os_defines.h:39,
from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
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__ ((__const__));
^
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.
Diffstat (limited to 'tests/local.at')
-rw-r--r-- | tests/local.at | 2 |
1 files changed, 1 insertions, 1 deletions
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). m4_define([AT_DATA_SOURCE_PROLOGUE], -[[/* 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. */ |