diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-05-14 09:48:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-05-14 09:48:54 +0200 |
commit | a1b893afc5c58fee6df5fb895cd489ec83e6facf (patch) | |
tree | ffb6727263b19aa25ff1b40613dcc77b8703a148 /libbuild2/cxx/init.cxx | |
parent | 07afeea65fd9a663d5b45db7aaf74716a0689142 (diff) |
Map latest/experimental cxx.std values to C++26 from GCC 14 and Clang 18
Diffstat (limited to 'libbuild2/cxx/init.cxx')
-rw-r--r-- | libbuild2/cxx/init.cxx | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 2d897ca..3185eaa 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -335,7 +335,12 @@ namespace build2 { case compiler_type::gcc: { - if (mj >= 11) + if (mj >= 14) + { + o = "-std=c++26"; + cplusplus = 202400; + } + else if (mj >= 11) { o = "-std=c++23"; cplusplus = 202302; @@ -367,25 +372,29 @@ namespace build2 } case compiler_type::clang: { - // Clang 10.0.0 targeting MSVC 16.4 and 16.5 (preview) in the - // c++2a mode uncovers some Concepts-related bugs in MSVC STL - // (LLVM bug #44956). So in this case we map `latest` to - // c++17. - // - // While reportedly this has been fixed in the later versions - // of MSVC, instead of somehow passing the version of MSVC - // Clang is targeting, we will just assume that Clang 11 - // and later are used with a sufficiently new version of - // MSVC. - // - - if (mj >= 13) + if (mj >= 18) + { + o = "-std=c++26"; + cplusplus = 202400; + } + else if (mj >= 13) { o = "-std=c++2b"; cplusplus = 202302; } else if (mj == 10 && latest && tt.system == "win32-msvc") { + // Clang 10.0.0 targeting MSVC 16.4 and 16.5 (preview) in + // the c++2a mode uncovers some Concepts-related bugs in + // MSVC STL (LLVM bug #44956). So in this case we map + // `latest` to c++17. + // + // While reportedly this has been fixed in the later + // versions of MSVC, instead of somehow passing the version + // of MSVC Clang is targeting, we will just assume that + // Clang 11 and later are used with a sufficiently new + // version of MSVC. + // o = "-std=c++17"; cplusplus = 201703; } @@ -446,7 +455,7 @@ namespace build2 // 26 to 2c for compatibility with older versions of the // compilers. // - // @@ TMP: update C++26 __cplusplus value once known. + // @@ TMP: update C++26 __cplusplus value once known (and above). // o = "-std="; |