aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-27 23:51:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-28 15:01:48 +0300
commitdee4003df645803a7883fd7b97dab7ca6b1f79ae (patch)
tree1078faff56d8ffbc2b441bf2b9c59f2927fbba2d /build2
parentac87e3827b214c0ba1bd1c17a2d8a18026637d3f (diff)
Add build2_cli_load()
Diffstat (limited to 'build2')
-rw-r--r--build2/b.cxx10
-rw-r--r--build2/cli/init.cxx16
-rw-r--r--build2/cli/init.hxx26
3 files changed, 26 insertions, 26 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index a4e799c..d6b364d 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -507,12 +507,6 @@ main (int argc, char* argv[])
loaded_modules[i->name] = i;
};
- // @@ TMP
- //
-#define TMP_LOAD(N, S, I) \
- static const module_functions N {S, nullptr, &I}; \
- loaded_modules[S] = &N
-
load (&config::build2_config_load);
load (&dist::build2_dist_load);
load (&test::build2_test_load);
@@ -526,9 +520,7 @@ main (int argc, char* argv[])
load (&in::build2_in_load);
#ifndef BUILD2_BOOTSTRAP
- TMP_LOAD (cli_config, "cli.config", cli::config_init);
- TMP_LOAD (cli, "cli", cli::init);
-
+ load (&cli::build2_cli_load);
load (&bash::build2_bash_load);
#endif
}
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 7b7a519..67aad29 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -368,5 +368,21 @@ namespace build2
return true;
}
+
+ static const module_functions mod_functions[] =
+ {
+ // NOTE: don't forget to also update the documentation in init.hxx if
+ // changing anything here.
+
+ {"cli.config", nullptr, config_init},
+ {"cli", nullptr, init},
+ {nullptr, nullptr, nullptr}
+ };
+
+ const module_functions*
+ build2_cli_load ()
+ {
+ return mod_functions;
+ }
}
}
diff --git a/build2/cli/init.hxx b/build2/cli/init.hxx
index 341dc11..4bb7d0d 100644
--- a/build2/cli/init.hxx
+++ b/build2/cli/init.hxx
@@ -14,23 +14,15 @@ namespace build2
{
namespace cli
{
- bool
- config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
+ // Module `cli` does not require bootstrapping.
+ //
+ // Submodules:
+ //
+ // `cli.config` -- registers variables.
+ // `cli` -- loads cli.config and registers target types and rules.
+ //
+ extern "C" const module_functions*
+ build2_cli_load ();
}
}