aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/c/init.cxx22
-rw-r--r--libbuild2/cxx/init.cxx17
2 files changed, 23 insertions, 16 deletions
diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx
index af27103..7129f37 100644
--- a/libbuild2/c/init.cxx
+++ b/libbuild2/c/init.cxx
@@ -72,8 +72,10 @@ namespace build2
// So let's say C99 is supported from 10.0 and C11 from 11.0. And
// C90 is supported by everything we care to support.
//
- // C17 is a bug-fix version of C11 so here we assume it is the same
- // as C11.
+ // 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.
//
if (v == nullptr)
;
@@ -81,9 +83,11 @@ namespace build2
{
uint64_t cver (ci.version.major);
- if ((*v == "99" && cver < 16) || // Since VS2010/10.0.
+ if ((*v == "99" && cver < 16) || // Since VS2010/10.0.
((*v == "11" ||
- *v == "17") && cver < 17)) // Since VS2012/11.0.
+ *v == "17" ||
+ *v == "18") && cver < 18) ||
+ (*v == "2x" ))
{
fail << "C" << *v << " is not supported by " << ci.signature <<
info << "required by " << project (rs) << '@' << rs;
@@ -102,11 +106,13 @@ namespace build2
{
string o ("-std=");
- if (*v == "90") o += "c90";
- else if (*v == "99") o += "c9x";
+ if (*v == "2x") o += "c2x"; // GCC 9, Clang 9 (8?).
+ else if (*v == "17" ||
+ *v == "18") o += "c17"; // GCC 8, Clang 6.
else if (*v == "11") o += "c1x";
- else if (*v == "17") o += "c17"; // GCC 8, Clang 6.
- else o += *v; // In case the user specifies e.g., 'gnu11'.
+ else if (*v == "99") o += "c9x";
+ else if (*v == "90") o += "c90";
+ else o += *v; // In case the user specifies `gnuNN` or some such.
r.push_back (move (o));
}
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index 4f2b5eb..851ea0c 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -225,18 +225,19 @@ namespace build2
;
else
{
- // Translate 11 to 0x, 14 to 1y, 17 to 1z, and 20 to 2a for
- // compatibility with older versions of the compilers.
+ // 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.
//
o = "-std=";
- if (*v == "98") o += "c++98";
- else if (*v == "03") o += "c++03";
- else if (*v == "11") o += "c++0x";
- else if (*v == "14") o += "c++1y";
- else if (*v == "17") o += "c++1z";
+ if (*v == "23") o += "c++2b";
else if (*v == "20") o += "c++2a";
- else o += *v; // In case the user specifies e.g., 'gnu++17'.
+ else if (*v == "17") o += "c++1z";
+ else if (*v == "14") o += "c++1y";
+ else if (*v == "11") o += "c++0x";
+ else if (*v == "03") o += "c++03";
+ else if (*v == "98") o += "c++98";
+ else o += *v; // In case the user specifies `gnu++NN` or some such.
}
if (!o.empty ())