Commit Graph

12 Commits

Author SHA1 Message Date
Akim Demaille
36f37568ba glr2.cc: require C++11
Reported by Dagobert Michelsen.
https://lists.gnu.org/r/bug-bison/2021-08/msg00006.html

* m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): We don't need
vector::data, it was only for glr2.cc, which is C++11 anyway.
(_BISON_CXXSTD_11_snippet): We need vector::data and std::swap on
arrays.
* m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): We don't need
vector::data.
* tests/local.at (AT_COMPILE_CXX): Skip when glr2.cc and no support
for C++11.
2021-08-19 08:21:22 +02:00
Akim Demaille
9307c173c7 build: reject C++ compilers that don't support std::vector::data
GCC 4.2 on macOS claims to support C++98, but does not feature it.

input.cc: In member function 'void state_stack::yycompressStack()':
input.cc:1774: error: 'class std::vector<glr_stack_item, std::allocator<glr_stack_item> >' has no member named 'data'

Reported by Christopher Nielsen <mascguy@github.com>.
<https://trac.macports.org/raw-attachment/ticket/59927/bison-test-results-20210811-95b72.log.xz>.

* m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): Check for it.
* m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Ditto.
2021-08-12 10:13:26 +02:00
Akim Demaille
15ba35a51b build: check for C++ 20 and 2b
C++20 is released.

* configure.ac, m4/bison-cxx-std.m4, tests/atlocal.in,
* tests/local.at: Replace 2a with 20, and add support for 2b.
2021-08-12 09:07:36 +02:00
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Akim Demaille
8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Akim Demaille
9114b267a8 c++: beware of to_string portability issues
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00033.html

* m4/bison-cxx-std.m4 (_BISON_CXXSTD_11_snippet): Check it.
2019-05-20 06:27:55 +02:00
Akim Demaille
5d0764d23b build: rename and simplify the -std checks for C++
Too much code duplication.

* m4/bison-cxx-std.m4: s/BISON_CXX_COMPILE_STDCXX/BISON_CXXSTD/.
(BISON_CXXSTD): New.
* configure.ac: Use it.
2018-09-23 11:50:58 +02:00
Akim Demaille
41ded58286 build: check for C++98 and 03 like the others
* m4/bison-cxx-std.m4 (BISON_CXX_COMPILE_STDCXX_98)
(BISON_CXX_COMPILE_STDCXX_03): New.
* configure.ac: Use them.
2018-09-23 11:50:58 +02:00
Akim Demaille
5649888686 build: use our own version of ax_check_link_flag
The message on configure is misleading:

    checking whether the linker accepts -std=c++11... yes
    checking whether the linker accepts -std=c++14... yes
    checking whether the linker accepts -std=c++17... no

It is the compiler that we check, not just the linker.

* m4/ax_check_link_flag.m4: Remove.
* m4/bison-check-compiler-flag.m4: New.
* m4/bison-cxx-std.m4: Use it.
2018-09-23 11:50:58 +02:00
Akim Demaille
e40a3eed34 build: fix Autoconf macros to check for C++ standard flags
* m4/bison-cxx-std.m4: Since now we link the program, we need a
program: main was missing and linking was failing.
2018-09-23 11:50:58 +02:00
Akim Demaille
49dc1b5bf1 build: don't accept a broken standard lib for C++
On the CI, we had failures such as:

    ./c++.at:401:  $PREPARSER ./list
    stderr:
    ./list: error while loading shared libraries: libc++.so.1:
            cannot open shared object file: No such file or directory

because we accepted `-std=c++ -stdlib=libc++` although libc++ is not
installed on the machine.

* m4/ax_check_compile_flag.m4 (AX_CHECK_COMPILE_FLAG): Rewrite as...
* m4/bison-check-compile-flag.m4 (BISON_CHECK_COMPILE_FLAG): this, so
that we use AC_LINK_IFELSE to check the compiler (and its std lib)
instead of AC_COMPILE_IFELSE.
2018-09-19 06:02:41 +02:00
Akim Demaille
3367d8dd5c build: strengthen the C++ standard flag test
On the CI, we have this spurious failure with clang 3.9 with
-std=c++17:

    In file included from list.y:23:
    In file included from /usr/include/c++/4.8/iostream:39:
    In file included from /usr/include/c++/4.8/ostream:38:
    In file included from /usr/include/c++/4.8/ios:42:
    In file included from /usr/include/c++/4.8/bits/ios_base.h:41:
    In file included from /usr/include/c++/4.8/bits/locale_classes.h:40:
    In file included from /usr/include/c++/4.8/string:52:
    In file included from /usr/include/c++/4.8/bits/basic_string.h:2815:
    In file included from /usr/include/c++/4.8/ext/string_conversions.h:43:
    /usr/include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
      using ::gets;
            ~~^

This shows that our test, based on gl_WARN_ADD, is a joke.  We have to
really check for at least a bit of C++.

* m4/ax_check_compile_flag.m4, m4/bison-cxx-std.m4: New.
* configure.ac: Use them to make sure the compiler actually works.
2018-09-18 13:21:38 +02:00