aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-28 09:14:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-28 16:03:35 +0200
commit3ce44330cca9dbc4314feebb27403ebc3175b6c2 (patch)
tree8c1f27442f3b2dafaec3ba50baaca3d5fd63dca7 /build2/cxx
parent9d0d078ff297138622cd2f3f1076f5984395e42b (diff)
New variable architecture
Diffstat (limited to 'build2/cxx')
-rw-r--r--build2/cxx/compile.cxx16
-rw-r--r--build2/cxx/link.cxx30
-rw-r--r--build2/cxx/module.cxx12
-rw-r--r--build2/cxx/utility.txx2
4 files changed, 30 insertions, 30 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index df2b798..a2b00de 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -130,7 +130,7 @@ namespace build2
//
if (a == perform_update_id)
{
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
// The cached prerequisite target should be the same as what is in
// t.prerequisite_targets since we used standard search() and match()
@@ -165,7 +165,7 @@ namespace build2
// Then the compiler checksum.
//
- if (dd.expect (as<string> (*rs["cxx.checksum"])) != nullptr)
+ if (dd.expect (cast<string> (*rs["cxx.checksum"])) != nullptr)
l4 ([&]{trace << "compiler mismatch forcing update of " << t;});
// Then the options checksum.
@@ -237,7 +237,7 @@ namespace build2
-> const target_type*
{
if (auto l = s.lookup (tt, n, var))
- if (as<string> (*l) == e)
+ if (cast<string> (*l) == e)
return &tt;
return nullptr;
@@ -283,7 +283,7 @@ namespace build2
if (auto l = t[var])
{
- const auto& v (as<strings> (*l));
+ const auto& v (cast<strings> (*l));
for (auto i (v.begin ()), e (v.end ()); i != e; ++i)
{
@@ -461,8 +461,8 @@ namespace build2
auto init_args = [&t, &s, &rs, &args, &cxx_std] ()
{
- const string& cxx (as<string> (*rs["config.cxx"]));
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& cxx (cast<string> (*rs["config.cxx"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
args.push_back (cxx.c_str ());
@@ -923,8 +923,8 @@ namespace build2
path rels (relative (s->path ()));
scope& rs (t.root_scope ());
- const string& cxx (as<string> (*rs["config.cxx"]));
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& cxx (cast<string> (*rs["config.cxx"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
cstrings args {cxx.c_str ()};
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index 5ed36b7..ea20a47 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -42,7 +42,7 @@ namespace build2
case type::so: var = "bin.libso.lib"; break;
}
- const auto& v (as<strings> (*t[var]));
+ const auto& v (cast<strings> (*t[var]));
return v[0] == "shared"
? v.size () > 1 && v[1] == "static" ? order::so_a : order::so
: v.size () > 1 && v[1] == "shared" ? order::a_so : order::a;
@@ -52,7 +52,7 @@ namespace build2
link_member (bin::lib& l, order lo)
{
bool lso (true);
- const string& at (as<string> (*l["bin.lib"])); // Available types.
+ const string& at (cast<string> (*l["bin.lib"])); // Available types.
switch (lo)
{
@@ -92,7 +92,7 @@ namespace build2
//
if (auto l = bs["cxx.loptions"])
{
- const auto& v (as<strings> (*l));
+ const auto& v (cast<strings> (*l));
for (auto i (v.begin ()), e (v.end ()); i != e; ++i)
{
@@ -123,7 +123,7 @@ namespace build2
cstrings args;
string std_storage;
- args.push_back (as<string> (*rs["config.cxx"]).c_str ());
+ args.push_back (cast<string> (*rs["config.cxx"]).c_str ());
append_options (args, bs, "cxx.coptions");
append_std (args, bs, std_storage);
append_options (args, bs, "cxx.loptions");
@@ -218,7 +218,7 @@ namespace build2
return p.target;
scope& rs (*p.scope.root_scope ());
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
bool l (p.is_a<lib> ());
const string* ext (l ? nullptr : p.ext); // Only for liba/libso.
@@ -483,7 +483,7 @@ namespace build2
path_target& t (static_cast<path_target&> (xt));
scope& rs (t.root_scope ());
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
type lt (link_type (t));
bool so (lt == type::so);
@@ -510,7 +510,7 @@ namespace build2
case type::so:
{
auto l (t["bin.libprefix"]);
- const char* p (l ? as<string> (*l).c_str () : "lib");
+ const char* p (l ? cast<string> (*l).c_str () : "lib");
const char* e;
if (lt == type::a)
@@ -769,7 +769,7 @@ namespace build2
bool up (execute_prerequisites (a, t, t.mtime ()));
scope& rs (t.root_scope ());
- const string& sys (as<string> (*rs["cxx.target.system"]));
+ const string& sys (cast<string> (*rs["cxx.target.system"]));
// Check/update the dependency database.
//
@@ -793,10 +793,10 @@ namespace build2
const char* rl (
ranlib
- ? as<string> (*rs["bin.ranlib.checksum"]).c_str ()
+ ? cast<string> (*rs["bin.ranlib.checksum"]).c_str ()
: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
- if (dd.expect (as<string> (*rs["bin.ar.checksum"])) != nullptr)
+ if (dd.expect (cast<string> (*rs["bin.ar.checksum"])) != nullptr)
l4 ([&]{trace << "ar mismatch forcing update of " << t;});
if (dd.expect (rl) != nullptr)
@@ -804,7 +804,7 @@ namespace build2
}
else
{
- if (dd.expect (as<string> (*rs["cxx.checksum"])) != nullptr)
+ if (dd.expect (cast<string> (*rs["cxx.checksum"])) != nullptr)
l4 ([&]{trace << "compiler mismatch forcing update of " << t;});
}
@@ -877,7 +877,7 @@ namespace build2
// precedence.
//
if (auto l = t["bin.rpath"])
- for (const string& p: as<strings> (*l))
+ for (const string& p: cast<strings> (*l))
sargs.push_back ("-Wl,-rpath," + p);
// Then the paths of the shared libraries we are linking to. Unless
@@ -978,12 +978,12 @@ namespace build2
if (lt == type::a)
{
- args[0] = as<string> (*rs["config.bin.ar"]).c_str ();
+ args[0] = cast<string> (*rs["config.bin.ar"]).c_str ();
args.push_back (relt.string ().c_str ());
}
else
{
- args[0] = as<string> (*rs["config.cxx"]).c_str ();
+ args[0] = cast<string> (*rs["config.cxx"]).c_str ();
args.push_back ("-o");
args.push_back (relt.string ().c_str ());
}
@@ -1048,7 +1048,7 @@ namespace build2
if (ranlib)
{
const char* args[] = {
- as<string> (*ranlib).c_str (), relt.string ().c_str (), nullptr};
+ cast<string> (*ranlib).c_str (), relt.string ().c_str (), nullptr};
if (verb >= 2)
print_process (args);
diff --git a/build2/cxx/module.cxx b/build2/cxx/module.cxx
index 7c6a4dd..d491079 100644
--- a/build2/cxx/module.cxx
+++ b/build2/cxx/module.cxx
@@ -46,7 +46,7 @@ namespace build2
{
auto l (b["bin.loaded"]);
- if (!l || !as<bool> (*l))
+ if (!l || !cast<bool> (*l))
load_module (false, "bin", r, b, loc);
}
@@ -157,16 +157,16 @@ namespace build2
// cxx.coptions += <overriding options> # Note: '+='.
//
if (const value& v = config::optional (r, "config.cxx.poptions"))
- b.assign ("cxx.poptions") += as<strings> (v);
+ b.assign ("cxx.poptions") += cast<strings> (v);
if (const value& v = config::optional (r, "config.cxx.coptions"))
- b.assign ("cxx.coptions") += as<strings> (v);
+ b.assign ("cxx.coptions") += cast<strings> (v);
if (const value& v = config::optional (r, "config.cxx.loptions"))
- b.assign ("cxx.loptions") += as<strings> (v);
+ b.assign ("cxx.loptions") += cast<strings> (v);
if (const value& v = config::optional (r, "config.cxx.libs"))
- b.assign ("cxx.libs") += as<strings> (v);
+ b.assign ("cxx.libs") += cast<strings> (v);
// config.cxx
//
@@ -176,7 +176,7 @@ namespace build2
// Figure out which compiler we are dealing with, its target, etc.
//
- const path& cxx (path (as<string> (p.first))); // @@ VAR
+ const path& cxx (path (cast<string> (p.first))); // @@ VAR
compiler_info ci (guess (cxx, r["cxx.coptions"]));
// If this is a new value (e.g., we are configuring), then print the
diff --git a/build2/cxx/utility.txx b/build2/cxx/utility.txx
index ed35fdb..c20e437 100644
--- a/build2/cxx/utility.txx
+++ b/build2/cxx/utility.txx
@@ -14,7 +14,7 @@ namespace build2
{
if (auto l = t["cxx.std"])
{
- const string& v (as<string> (*l));
+ const string& v (cast<string> (*l));
// Translate 11 to 0x and 14 to 1y for compatibility with older
// versions of the compiler.