From 68f96f9213e849d0d7c4cedf3edeaec99743ee27 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Aug 2015 09:51:15 +0200 Subject: New variable architecture --- build/cxx/link.cxx | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'build/cxx/link.cxx') diff --git a/build/cxx/link.cxx b/build/cxx/link.cxx index 97c9696..1b900c2 100644 --- a/build/cxx/link.cxx +++ b/build/cxx/link.cxx @@ -59,10 +59,10 @@ namespace build case type::so: var = "bin.libso.lib"; break; } - const list_value& lv (t[var].as ()); - return lv[0].value == "shared" - ? lv.size () > 1 && lv[1].value == "static" ? order::so_a : order::so - : lv.size () > 1 && lv[1].value == "shared" ? order::a_so : order::a; + const auto& v (as (*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; } link::search_paths link:: @@ -73,32 +73,24 @@ namespace build // Extract user-supplied search paths (i.e., -L). // - if (auto val = bs["cxx.loptions"]) + if (auto l = bs["cxx.loptions"]) { - const list_value& l (val.as ()); + const auto& v (as (*l)); - for (auto i (l.begin ()), e (l.end ()); i != e; ++i) + for (auto i (v.begin ()), e (v.end ()); i != e; ++i) { - if (!i->simple ()) - continue; - - // -L can either be in the -Lfoo or -L foo form. + // -L can either be in the "-Lfoo" or "-L foo" form. // dir_path d; - if (i->value == "-L") + if (*i == "-L") { if (++i == e) break; // Let the compiler complain. - if (i->simple ()) - d = dir_path (i->value); - else if (i->directory ()) - d = i->dir; - else - break; // Let the compiler complain. + d = dir_path (*i); } - else if (i->value.compare (0, 2, "-L") == 0) - d = dir_path (i->value, 2, string::npos); + else if (i->compare (0, 2, "-L") == 0) + d = dir_path (*i, 2, string::npos); else continue; @@ -114,7 +106,7 @@ namespace build cstrings args; string std_storage; - args.push_back (rs["config.cxx"].as ().c_str ()); + args.push_back (as (*rs["config.cxx"]).c_str ()); append_options (args, bs, "cxx.coptions"); append_std (args, bs, std_storage); append_options (args, bs, "cxx.loptions"); @@ -550,7 +542,7 @@ namespace build // Determine the library type to link. // bool lso (true); - const string& at ((*l)["bin.lib"].as ()); + const string& at (as (*(*l)["bin.lib"])); if (!lo) lo = link_order (t); @@ -776,10 +768,8 @@ namespace build } else { - args.push_back (rs["config.cxx"].as ().c_str ()); - + args.push_back (as (*rs["config.cxx"]).c_str ()); append_options (args, t, "cxx.coptions"); - append_std (args, t, storage1); if (so) -- cgit v1.1