aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config
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
parentccb417a7c1456427b76914e8a11ca87b4926eeb3 (diff)
Rename module_base to module, redo module boot/init argument passing
Diffstat (limited to 'libbuild2/config')
-rw-r--r--libbuild2/config/init.cxx23
-rw-r--r--libbuild2/config/init.hxx12
-rw-r--r--libbuild2/config/module.hxx2
3 files changed, 11 insertions, 26 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"]);
}
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<module_base>&);
-
- bool
- init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- 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;