bison-patches
[Top][All Lists]
Advanced

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

[PATCH 4/9] build: check for C++ 20 and 2b


From: Akim Demaille
Subject: [PATCH 4/9] build: check for C++ 20 and 2b
Date: Thu, 12 Aug 2021 10:18:27 +0200

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.
---
 configure.ac        |  3 ++-
 m4/bison-cxx-std.m4 | 44 ++++++++++++++++++++++++++++++--------------
 tests/atlocal.in    |  3 ++-
 tests/local.at      |  6 ++++--
 4 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index f4e02dd6..7c641e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,8 @@ BISON_CXXSTD([03])
 BISON_CXXSTD([11])
 BISON_CXXSTD([14])
 BISON_CXXSTD([17])
-BISON_CXXSTD([2a])
+BISON_CXXSTD([20])
+BISON_CXXSTD([2b])
 AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
 AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
 AC_LANG_POP([C++])
diff --git a/m4/bison-cxx-std.m4 b/m4/bison-cxx-std.m4
index 6f6717ae..65d59cc7 100644
--- a/m4/bison-cxx-std.m4
+++ b/m4/bison-cxx-std.m4
@@ -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_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_2A_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])
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 3481d22b..eabff450 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -60,7 +60,8 @@ fi
 : ${CXX11_CXXFLAGS='@CXX11_CXXFLAGS@'}
 : ${CXX14_CXXFLAGS='@CXX14_CXXFLAGS@'}
 : ${CXX17_CXXFLAGS='@CXX17_CXXFLAGS@'}
-: ${CXX2A_CXXFLAGS='@CXX2A_CXXFLAGS@'}
+: ${CXX20_CXXFLAGS='@CXX20_CXXFLAGS@'}
+: ${CXX2B_CXXFLAGS='@CXX2B_CXXFLAGS@'}
 
 # Whether the compiler supports POSIXLY_CORRECT defined.
 : ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
diff --git a/tests/local.at b/tests/local.at
index 3cf4a49e..39c9dbcd 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -881,7 +881,8 @@ m4_define([AT_FOR_EACH_CXX],
               ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \
               ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \
               ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \
-              ${CXX2A_CXXFLAGS:+"$CXX2A_CXXFLAGS"}
+              ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \
+              ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"}
 do
   ]AS_ECHO(["======== Testing with C++ standard flags: '$at_cxx_std'"])[
   CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std"
@@ -1510,7 +1511,8 @@ m4_define([AT_REQUIRE_CXX_STD],
     [11], [201103],
     [14], [201402],
     [17], [201703],
-    [2a], [201709],
+    [20], [202002],
+    [2b], [202100],
     [m4_fatal([$0: invalid arguments: $@])])[
   return 1;
 #else
-- 
2.32.0




reply via email to

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