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 ++++++++++------------- libbuild2/config/init.hxx | 12 ------------ libbuild2/config/module.hxx | 2 +- 3 files changed, 11 insertions(+), 26 deletions(-) (limited to 'libbuild2/config') 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"]); } diff --git a/libbuild2/config/init.hxx b/libbuild2/config/init.hxx index d6a1e08..d602ec9 100644 --- a/libbuild2/config/init.hxx +++ b/libbuild2/config/init.hxx @@ -16,18 +16,6 @@ namespace build2 { namespace config { - bool - boot (scope&, const location&, unique_ptr&); - - bool - init (scope&, - scope&, - const location&, - unique_ptr&, - bool, - bool, - const variable_map&); - // Module `config` requires bootstrapping. // // `config` -- registers the configure and disfigure meta-operations, diff --git a/libbuild2/config/module.hxx b/libbuild2/config/module.hxx index 0a35369..297db0a 100644 --- a/libbuild2/config/module.hxx +++ b/libbuild2/config/module.hxx @@ -74,7 +74,7 @@ namespace build2 } }; - struct module: module_base + struct module: build2::module { config::saved_modules saved_modules; -- cgit v1.1