From c4fcbad1cb603756dc4dac65392feb86be1a722d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Jan 2020 09:19:06 +0200 Subject: Rename module_base to module, redo module boot/init argument passing --- libbuild2/config/init.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'libbuild2/config/init.cxx') 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& 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 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& 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 ("config.config.load", true /* ovr */)); auto& c_v (vp.insert ("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 (*mod).persist = + auto& m (extra.module_as ()); + + m.persist = cast_null>> ( rs["config.config.persist"]); } -- cgit v1.1