diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 09:45:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 16:03:35 +0200 |
commit | 69801c4e23f877359118e55ed291737f4fbece04 (patch) | |
tree | cd4cb504a5c28aafde601e2d5d4603a44c75b548 /build2/cxx | |
parent | 3ce44330cca9dbc4314feebb27403ebc3175b6c2 (diff) |
Add variable cast from lookup
Diffstat (limited to 'build2/cxx')
-rw-r--r-- | build2/cxx/compile.cxx | 16 | ||||
-rw-r--r-- | build2/cxx/link.cxx | 30 | ||||
-rw-r--r-- | build2/cxx/module.cxx | 2 | ||||
-rw-r--r-- | build2/cxx/utility.txx | 2 |
4 files changed, 25 insertions, 25 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx index a2b00de..cf0c91c 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 (cast<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 (cast<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 (cast<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 (cast<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 (cast<string> (*rs["config.cxx"])); - const string& sys (cast<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 (cast<string> (*rs["config.cxx"])); - const string& sys (cast<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 ea20a47..c0ea6d3 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 (cast<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 (cast<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 (cast<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 (cast<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 (cast<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 (cast<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 ? cast<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 (cast<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 - ? cast<string> (*rs["bin.ranlib.checksum"]).c_str () + ? cast<string> (rs["bin.ranlib.checksum"]).c_str () : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); - if (dd.expect (cast<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 (cast<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: cast<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] = cast<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] = cast<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[] = { - cast<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 d491079..18f9e53 100644 --- a/build2/cxx/module.cxx +++ b/build2/cxx/module.cxx @@ -46,7 +46,7 @@ namespace build2 { auto l (b["bin.loaded"]); - if (!l || !cast<bool> (*l)) + if (!l || !cast<bool> (l)) load_module (false, "bin", r, b, loc); } diff --git a/build2/cxx/utility.txx b/build2/cxx/utility.txx index c20e437..4d38513 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 (cast<string> (*l)); + const string& v (cast<string> (l)); // Translate 11 to 0x and 14 to 1y for compatibility with older // versions of the compiler. |