aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-22 14:29:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-22 14:29:18 +0200
commitf705277ae8bfcd42317d6a82fb9cd824ba12054f (patch)
tree9c3ec3d4116bcd7b1f0ec85acd06f815ce43c357
parent7879d172dec3300341d3eff15808425e01c15569 (diff)
Map cxx.std=26 to -std=c++2c for GCC and Clang
-rw-r--r--libbuild2/c/init.cxx7
-rw-r--r--libbuild2/cxx/init.cxx10
2 files changed, 13 insertions, 4 deletions
diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx
index 222a4fe..42ade68 100644
--- a/libbuild2/c/init.cxx
+++ b/libbuild2/c/init.cxx
@@ -78,7 +78,12 @@ namespace build2
// C17/18 is a bug-fix version of C11 so here we assume it is the
// same as C11.
//
- // And it's still early days for C2X.
+ // And it's still early days for C2X. Specifically, there is not
+ // much about C2X in MSVC in the official places and the following
+ // page shows that it's pretty much unimplement at the time of the
+ // MSVC 17.6 release:
+ //
+ // https://en.cppreference.com/w/c/compiler_support/23
//
// From version 16.8 VC now supports /std:c11 and /std:c17 options
// which enable C11/17 conformance. However, as of version 16.10,
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index 2929def..3ca920e 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -194,6 +194,8 @@ namespace build2
// for this mode. So starting from 16 we only enable it in
// `experimental`.
//
+ // Note: no /std:c++23 yet as of MSVC 17.6.
+ //
if (v16_11)
o = "/std:c++20";
else if (v16_0)
@@ -316,12 +318,14 @@ namespace build2
;
else
{
- // Translate 11 to 0x, 14 to 1y, 17 to 1z, 20 to 2a, and 23 to 2b
- // for compatibility with older versions of the compilers.
+ // Translate 11 to 0x, 14 to 1y, 17 to 1z, 20 to 2a, 23 to 2b, and
+ // 26 to 2c for compatibility with older versions of the
+ // compilers.
//
o = "-std=";
- if (*v == "23") o += "c++2b";
+ if (*v == "26") o += "c++2c";
+ else if (*v == "23") o += "c++2b";
else if (*v == "20") o += "c++2a";
else if (*v == "17") o += "c++1z";
else if (*v == "14") o += "c++1y";