mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
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.
This commit is contained in:
@@ -7,16 +7,17 @@
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
m4_define([_BISON_CXXSTD_98_snippet],
|
||||
[#include <vector>
|
||||
[[#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
typedef std::vector<int> ints;
|
||||
])
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_03_snippet],
|
||||
[])
|
||||
|
||||
m4_define([_BISON_CXXSTD_11_snippet],
|
||||
[#include <algorithm>
|
||||
[[#include <algorithm>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
@@ -66,10 +67,10 @@ m4_define([_BISON_CXXSTD_11_snippet],
|
||||
|
||||
// GCC 4.8.2 on Solaris 11.3 does not support to_string.
|
||||
auto e = std::to_string(42);
|
||||
])
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_14_snippet],
|
||||
[ // C++14
|
||||
[[ // C++14
|
||||
void mismatch()
|
||||
{
|
||||
using ints = std::vector<int>;
|
||||
@@ -78,20 +79,24 @@ m4_define([_BISON_CXXSTD_14_snippet],
|
||||
std::mismatch(std::begin(v1), std::end(v1),
|
||||
std::begin(v2), std::end(v2));
|
||||
}
|
||||
])
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_17_snippet],
|
||||
[ // C++17
|
||||
[[ // C++17
|
||||
namespace ns1::ns2::ns3 {}
|
||||
|
||||
#include <optional>
|
||||
auto opt_string = std::optional<std::string>{};
|
||||
auto out = std::ostringstream{};
|
||||
])
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_2A_snippet],
|
||||
[ // C++2A
|
||||
])
|
||||
m4_define([_BISON_CXXSTD_20_snippet],
|
||||
[[ // C++20
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_2B_snippet],
|
||||
[[ // C++2B
|
||||
]])
|
||||
|
||||
|
||||
m4_define([_BISON_CXXSTD_testbody(98)],
|
||||
@@ -129,14 +134,25 @@ _BISON_CXXSTD_14_snippet
|
||||
_BISON_CXXSTD_17_snippet
|
||||
])])
|
||||
|
||||
m4_define([_BISON_CXXSTD_testbody(2a)],
|
||||
m4_define([_BISON_CXXSTD_testbody(20)],
|
||||
[AC_LANG_PROGRAM([
|
||||
_BISON_CXXSTD_98_snippet
|
||||
_BISON_CXXSTD_03_snippet
|
||||
_BISON_CXXSTD_11_snippet
|
||||
_BISON_CXXSTD_14_snippet
|
||||
_BISON_CXXSTD_17_snippet
|
||||
_BISON_CXXSTD_2A_snippet
|
||||
_BISON_CXXSTD_20_snippet
|
||||
])])
|
||||
|
||||
m4_define([_BISON_CXXSTD_testbody(2b)],
|
||||
[AC_LANG_PROGRAM([
|
||||
_BISON_CXXSTD_98_snippet
|
||||
_BISON_CXXSTD_03_snippet
|
||||
_BISON_CXXSTD_11_snippet
|
||||
_BISON_CXXSTD_14_snippet
|
||||
_BISON_CXXSTD_17_snippet
|
||||
_BISON_CXXSTD_20_snippet
|
||||
_BISON_CXXSTD_2B_snippet
|
||||
])])
|
||||
|
||||
|
||||
@@ -148,7 +164,7 @@ m4_define([_BISON_CXXSTD_testbody],
|
||||
|
||||
# BISON_CXXSTD(STD)
|
||||
# -----------------
|
||||
# Check whether the C++ compiler support STD (11, 98, 2a, etc.).
|
||||
# Check whether the C++ compiler support STD (11, 98, 2b, etc.).
|
||||
# If it does, AC_SUBST 'CXX<STD>_CXXFLAGS' to the corresponding flags.
|
||||
AC_DEFUN([BISON_CXXSTD],
|
||||
[AC_REQUIRE([AC_PROG_CXX])
|
||||
|
||||
Reference in New Issue
Block a user