aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/c/init.cxx6
-rw-r--r--libbuild2/cc/module.cxx2
-rw-r--r--libbuild2/cc/module.hxx5
-rw-r--r--libbuild2/cxx/init.cxx29
4 files changed, 34 insertions, 8 deletions
diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx
index d792f0d..ffea0ca 100644
--- a/libbuild2/c/init.cxx
+++ b/libbuild2/c/init.cxx
@@ -38,6 +38,7 @@ namespace build2
virtual strings
translate_std (const compiler_info&,
+ const target_triplet&,
scope&,
const string*) const override;
};
@@ -45,7 +46,10 @@ namespace build2
using cc::module;
strings config_module::
- translate_std (const compiler_info& ci, scope& rs, const string* v) const
+ translate_std (const compiler_info& ci,
+ const target_triplet&,
+ scope& rs,
+ const string* v) const
{
strings r;
diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx
index c74f26d..d8365e4 100644
--- a/libbuild2/cc/module.cxx
+++ b/libbuild2/cc/module.cxx
@@ -384,7 +384,7 @@ namespace build2
// Translate x_std value (if any) to the compiler option(s) (if any).
//
- tstd = translate_std (xi, rs, v);
+ tstd = translate_std (xi, tt, rs, v);
}
// config.x.translatable_header
diff --git a/libbuild2/cc/module.hxx b/libbuild2/cc/module.hxx
index d496779..4eca976 100644
--- a/libbuild2/cc/module.hxx
+++ b/libbuild2/cc/module.hxx
@@ -48,7 +48,10 @@ namespace build2
// root scope.
//
virtual strings
- translate_std (const compiler_info&, scope&, const string*) const = 0;
+ translate_std (const compiler_info&,
+ const target_triplet&,
+ scope&,
+ const string*) const = 0;
strings tstd;
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index a886cbc..4c4f6ad 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -39,6 +39,7 @@ namespace build2
virtual strings
translate_std (const compiler_info&,
+ const target_triplet&,
scope&,
const string*) const override;
};
@@ -46,7 +47,10 @@ namespace build2
using cc::module;
strings config_module::
- translate_std (const compiler_info& ci, scope& rs, const string* v) const
+ translate_std (const compiler_info& ci,
+ const target_triplet& tt,
+ scope& rs,
+ const string* v) const
{
strings r;
@@ -63,9 +67,9 @@ namespace build2
// that is not necessarily complete or final but is practically usable.
// In other words, a project that uses this value and does not rely on
// any unstable/bleeding edge parts of the standard (or takes care to
- // deal with them, for example, using feature test macros), can
- // reasonably expect to work. In particular, this is the value we use by
- // default in projects created by bdep-new(1) as well as to build the
+ // deal with them, for example, using feature test macros), can be
+ // reasonably expected to work. In particular, this is the value we use
+ // by default in projects created by bdep-new(1) as well as to build the
// build2 toolchain itself.
//
// The `experimental` value, as the name suggests, is the latest
@@ -199,7 +203,22 @@ namespace build2
}
case compiler_type::clang:
{
- if (mj >= 5) o = "-std=c++2a";
+ // Clang 10.0.0 targeting MSVC 16.4 and 16.5 (preview) in the
+ // c++2a mode uncovers some Concepts-related bugs in MSVC
+ // (LLVM bug #44956). So in this case we for now map `latest`
+ // to c++17. @@ TMP
+ //
+ // Note that if 10.0.0 is released without a workaround, then
+ // we will need to carry this forward at least for 16.4 since
+ // this version is unlikely to ever be fixed. Which means we
+ // will somehow need to pass the version of MSVC Clang is
+ // targeting.
+ //
+ if (latest && mj == 10 && tt.system == "win32-msvc")
+ {
+ o = "-std=c++17";
+ }
+ else if (mj >= 5) o = "-std=c++2a";
else if (mj > 3 || (mj == 3 && mi >= 5)) o = "-std=c++1z";
else if (mj == 3 && mi >= 4) o = "-std=c++1y";
else /* ??? */ o = "-std=c++0x";