aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-29 09:19:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-01-29 09:19:06 +0200
commitc4fcbad1cb603756dc4dac65392feb86be1a722d (patch)
treeda9c9c2278c63d20237a7178fde450d7472a59c9 /libbuild2/config/init.cxx
parentccb417a7c1456427b76914e8a11ca87b4926eeb3 (diff)
Rename module_base to module, redo module boot/init argument passing
Diffstat (limited to 'libbuild2/config/init.cxx')
-rw-r--r--libbuild2/config/init.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx
index a7f3fc3..2f47486 100644
--- a/libbuild2/config/init.cxx
+++ b/libbuild2/config/init.cxx
@@ -30,7 +30,7 @@ namespace build2
functions (function_map&); // functions.cxx
bool
- boot (scope& rs, const location&, unique_ptr<module_base>& mod)
+ boot (scope& rs, const location&, module_boot_extra& extra)
{
tracer trace ("config::boot");
@@ -113,17 +113,15 @@ namespace build2
//
vp.insert ("config.import");
- unique_ptr<module> m (new module);
+ auto& m (extra.set_module (new module));
// Adjust priority for the config module and import pseudo-module so
// that their variables come first in config.build.
//
- m->save_module ("config", INT32_MIN);
- m->save_module ("import", INT32_MIN);
+ m.save_module ("config", INT32_MIN);
+ m.save_module ("import", INT32_MIN);
- m->save_variable (c_p, omit_null);
-
- mod = move (m);
+ m.save_variable (c_p, omit_null);
}
// Register the config function family if this is the first instance of
@@ -149,10 +147,9 @@ namespace build2
init (scope& rs,
scope&,
const location& l,
- unique_ptr<module_base>& mod,
bool first,
bool,
- const variable_map& config_hints)
+ module_init_extra& extra)
{
tracer trace ("config::init");
@@ -164,8 +161,6 @@ namespace build2
l5 ([&]{trace << "for " << rs;});
- assert (config_hints.empty ()); // We don't known any hints.
-
auto& vp (rs.var_pool ());
auto& c_l (vp.insert<paths> ("config.config.load", true /* ovr */));
auto& c_v (vp.insert<uint64_t> ("config.version", false /*ovr*/));
@@ -266,9 +261,11 @@ namespace build2
// Cache the config.config.persist value, if any.
//
- if (mod != nullptr)
+ if (extra.module != nullptr)
{
- static_cast<module&> (*mod).persist =
+ auto& m (extra.module_as<module> ());
+
+ m.persist =
cast_null<vector<pair<string, string>>> (
rs["config.config.persist"]);
}