aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/algorithm15
-rw-r--r--build2/algorithm.cxx8
-rw-r--r--build2/algorithm.ixx18
-rw-r--r--build2/b-options4
-rw-r--r--build2/b-options.cxx4
-rw-r--r--build2/b-options.ixx2
-rw-r--r--build2/b.cli2
-rw-r--r--build2/b.cxx6
-rw-r--r--build2/bin/module.cxx2
-rw-r--r--build2/bin/rule7
-rw-r--r--build2/bin/rule.cxx4
-rw-r--r--build2/bin/target3
-rw-r--r--build2/buildfile1
-rw-r--r--build2/cli/module.cxx2
-rw-r--r--build2/cli/rule5
-rw-r--r--build2/cli/rule.cxx3
-rw-r--r--build2/cli/target3
-rw-r--r--build2/config/module.cxx2
-rw-r--r--build2/config/operation3
-rw-r--r--build2/config/utility24
-rw-r--r--build2/config/utility.txx6
-rw-r--r--build2/context11
-rw-r--r--build2/context.cxx6
-rw-r--r--build2/context.txx6
-rw-r--r--build2/cxx/compile4
-rw-r--r--build2/cxx/compile.cxx5
-rw-r--r--build2/cxx/install4
-rw-r--r--build2/cxx/install.cxx2
-rw-r--r--build2/cxx/link12
-rw-r--r--build2/cxx/link.cxx6
-rw-r--r--build2/cxx/module.cxx2
-rw-r--r--build2/cxx/target3
-rw-r--r--build2/cxx/utility6
-rw-r--r--build2/cxx/utility.txx4
-rw-r--r--build2/diagnostics34
-rw-r--r--build2/diagnostics.cxx4
-rw-r--r--build2/dist/module.cxx11
-rw-r--r--build2/dist/operation3
-rw-r--r--build2/dist/operation.cxx2
-rw-r--r--build2/dist/rule6
-rw-r--r--build2/dist/rule.cxx2
-rw-r--r--build2/dump3
-rw-r--r--build2/dump.cxx3
-rw-r--r--build2/file5
-rw-r--r--build2/file.cxx2
-rw-r--r--build2/install/operation3
-rw-r--r--build2/install/rule8
-rw-r--r--build2/install/rule.cxx4
-rw-r--r--build2/install/utility11
-rw-r--r--build2/lexer8
-rw-r--r--build2/module2
-rw-r--r--build2/module.cxx2
-rw-r--r--build2/name.cxx2
-rw-r--r--build2/operation37
-rw-r--r--build2/operation.cxx7
-rw-r--r--build2/parser28
-rw-r--r--build2/parser.cxx6
-rw-r--r--build2/path-io26
-rw-r--r--build2/path-io.cxx39
-rw-r--r--build2/prerequisite46
-rw-r--r--build2/prerequisite.cxx8
-rw-r--r--build2/rule19
-rw-r--r--build2/rule-map14
-rw-r--r--build2/rule.cxx3
-rw-r--r--build2/scope7
-rw-r--r--build2/search1
-rw-r--r--build2/search.cxx3
-rw-r--r--build2/spec40
-rw-r--r--build2/spec.cxx2
-rw-r--r--build2/target106
-rw-r--r--build2/target-key7
-rw-r--r--build2/target-type6
-rw-r--r--build2/target.cxx6
-rw-r--r--build2/test/module2
-rw-r--r--build2/test/operation3
-rw-r--r--build2/test/rule5
-rw-r--r--build2/test/rule.cxx2
-rw-r--r--build2/token25
-rw-r--r--build2/token.cxx2
-rw-r--r--build2/types53
-rw-r--r--build2/utility20
-rw-r--r--build2/utility.cxx35
-rw-r--r--build2/variable78
-rw-r--r--build2/variable.cxx5
-rw-r--r--build2/variable.ixx64
-rw-r--r--build2/variable.txx20
86 files changed, 479 insertions, 556 deletions
diff --git a/build2/algorithm b/build2/algorithm
index 33c60ba..f0f2fbf 100644
--- a/build2/algorithm
+++ b/build2/algorithm
@@ -5,10 +5,9 @@
#ifndef BUILD2_ALGORITHM
#define BUILD2_ALGORITHM
-#include <string>
-#include <utility> // pair
-
#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
#include <build2/operation>
@@ -43,8 +42,8 @@ namespace build2
target&
search (const target_type& type,
const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
scope*);
// As above but specify the target type as template argument.
@@ -52,8 +51,8 @@ namespace build2
template <typename T>
T&
search (const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
scope*);
// Search for a target identified by the name. The semantics
@@ -91,7 +90,7 @@ namespace build2
// that unlike match(), this call doesn't increment the
// dependents count. See also the companion execute_delegate().
//
- std::pair<recipe, action>
+ pair<recipe, action>
match_delegate (action, target&);
// The standard prerequisite search and match implementations. They call
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index fa70260..fbc1a69 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -4,13 +4,6 @@
#include <build2/algorithm>
-#include <memory> // unique_ptr
-#include <cstddef> // size_t
-#include <utility> // move
-#include <cassert>
-
-#include <butl/utility> // reverse_iterate
-
#include <build2/scope>
#include <build2/target>
#include <build2/prerequisite>
@@ -18,7 +11,6 @@
#include <build2/file> // import()
#include <build2/search>
#include <build2/context>
-#include <build2/utility>
#include <build2/diagnostics>
using namespace std;
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx
index cdb76b5..19eb7e7 100644
--- a/build2/algorithm.ixx
+++ b/build2/algorithm.ixx
@@ -2,8 +2,6 @@
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <utility> // pair
-
#include <build2/rule>
#include <build2/prerequisite>
#include <build2/context>
@@ -30,8 +28,8 @@ namespace build2
inline target&
search (const target_type& type,
const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
scope* scope)
{
return search (
@@ -41,14 +39,14 @@ namespace build2
template <typename T>
inline T&
search (const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
scope* scope)
{
return static_cast<T&> (search (T::static_type, dir, name, ext, scope));
}
- std::pair<const rule*, match_result>
+ pair<const rule*, match_result>
match_impl (action, target&, bool apply);
inline void
@@ -80,13 +78,13 @@ namespace build2
match_impl (a, t, false);
}
- inline std::pair<recipe, action>
+ inline pair<recipe, action>
match_delegate (action a, target& t)
{
auto rp (match_impl (a, t, false));
const match_result& mr (rp.second);
- return std::make_pair (rp.first->apply (mr.recipe_action, t, mr),
- mr.recipe_action);
+ return make_pair (rp.first->apply (mr.recipe_action, t, mr),
+ mr.recipe_action);
}
group_view
diff --git a/build2/b-options b/build2/b-options
index 32a8709..e2bd37f 100644
--- a/build2/b-options
+++ b/build2/b-options
@@ -401,7 +401,7 @@ namespace build2
const bool&
q () const;
- const std::uint16_t&
+ const uint16_t&
verbose () const;
bool
@@ -446,7 +446,7 @@ namespace build2
public:
bool v_;
bool q_;
- std::uint16_t verbose_;
+ uint16_t verbose_;
bool verbose_specified_;
string pager_;
bool pager_specified_;
diff --git a/build2/b-options.cxx b/build2/b-options.cxx
index 8c06f59..5ad43f7 100644
--- a/build2/b-options.cxx
+++ b/build2/b-options.cxx
@@ -712,7 +712,7 @@ namespace build2
_cli_options_map_["-q"] =
&::build2::cl::thunk< options, bool, &options::q_ >;
_cli_options_map_["--verbose"] =
- &::build2::cl::thunk< options, std::uint16_t, &options::verbose_,
+ &::build2::cl::thunk< options, uint16_t, &options::verbose_,
&options::verbose_specified_ >;
_cli_options_map_["--pager"] =
&::build2::cl::thunk< options, string, &options::pager_,
@@ -830,7 +830,7 @@ namespace build2
<< "according to the build specification, or \033[4mbuildspec\033[0m for short. This process can" << ::std::endl
<< "be controlled by specifying driver \033[4moptions\033[0m and build system \033[4mvariables\033[0m." << ::std::endl
<< ::std::endl
- << "Note that \033[4moptions\033[0m, \033[4mvariables\033[0m and \033[4mbuildspec\033[0m fragments can be specified in any" << ::std::endl
+ << "Note that \033[4moptions\033[0m, \033[4mvariables\033[0m, and \033[4mbuildspec\033[0m fragments can be specified in any" << ::std::endl
<< "order. To avoid treating an argument that starts with \033[1m'-'\033[0m as an option, add the" << ::std::endl
<< "\033[1m'--'\033[0m separator. To avoid treating an argument that contains \033[1m'='\033[0m as a variable," << ::std::endl
<< "add the second \033[1m'--'\033[0m separator." << ::std::endl;
diff --git a/build2/b-options.ixx b/build2/b-options.ixx
index 7f4ab2a..fb7df02 100644
--- a/build2/b-options.ixx
+++ b/build2/b-options.ixx
@@ -228,7 +228,7 @@ namespace build2
return this->q_;
}
- inline const std::uint16_t& options::
+ inline const uint16_t& options::
verbose () const
{
return this->verbose_;
diff --git a/build2/b.cli b/build2/b.cli
index 84daee9..0fba654 100644
--- a/build2/b.cli
+++ b/build2/b.cli
@@ -197,7 +197,7 @@ namespace build2
\cb{--verbose 0}."
}
- std::uint16_t --verbose = 1
+ uint16_t --verbose = 1
{
"<level>",
"Set the diagnostics verbosity to <level> between 0 and 6. Level 0
diff --git a/build2/b.cxx b/build2/b.cxx
index 417008e..3512081 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -11,18 +11,17 @@
#include <pwd.h> // struct passwd, getpwuid()
#include <sstream>
-#include <cassert>
#include <cstring> // strcmp(), strchr()
#include <typeinfo>
#include <iostream>
-#include <system_error>
#include <butl/pager>
#include <butl/filesystem>
+#include <build2/types>
+#include <build2/utility>
#include <build2/version>
-#include <build2/types>
#include <build2/spec>
#include <build2/operation>
#include <build2/scope>
@@ -34,7 +33,6 @@
#include <build2/algorithm>
#include <build2/diagnostics>
#include <build2/context>
-#include <build2/utility>
#include <build2/variable>
#include <build2/token>
diff --git a/build2/bin/module.cxx b/build2/bin/module.cxx
index 472ee86..397ab74 100644
--- a/build2/bin/module.cxx
+++ b/build2/bin/module.cxx
@@ -33,7 +33,7 @@ namespace build2
bin_init (scope& r,
scope& b,
const location&,
- std::unique_ptr<module>&,
+ unique_ptr<module>&,
bool first,
bool)
{
diff --git a/build2/bin/rule b/build2/bin/rule
index 100697c..9bf1379 100644
--- a/build2/bin/rule
+++ b/build2/bin/rule
@@ -5,6 +5,9 @@
#ifndef BUILD2_BIN_RULE
#define BUILD2_BIN_RULE
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/rule>
namespace build2
@@ -15,7 +18,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -25,7 +28,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
diff --git a/build2/bin/rule.cxx b/build2/bin/rule.cxx
index 9b1b8c4..4b1da8f 100644
--- a/build2/bin/rule.cxx
+++ b/build2/bin/rule.cxx
@@ -20,7 +20,7 @@ namespace build2
// obj
//
match_result obj_rule::
- match (action a, target& t, const std::string&) const
+ match (action a, target& t, const string&) const
{
fail << diag_doing (a, t) << " target group" <<
info << "explicitly select either obja{} or objso{} member";
@@ -37,7 +37,7 @@ namespace build2
// members as our prerequisites.
//
match_result lib_rule::
- match (action a, target& xt, const std::string&) const
+ match (action a, target& xt, const string&) const
{
lib& t (static_cast<lib&> (xt));
diff --git a/build2/bin/target b/build2/bin/target
index 0816c66..f386592 100644
--- a/build2/bin/target
+++ b/build2/bin/target
@@ -5,6 +5,9 @@
#ifndef BUILD2_BIN_TARGET
#define BUILD2_BIN_TARGET
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
namespace build2
diff --git a/build2/buildfile b/build2/buildfile
index e47ca8c..9321026 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -17,7 +17,6 @@ exe{b}: \
{hxx cxx}{ name } \
{hxx cxx}{ operation } \
{hxx cxx}{ parser } \
- {hxx cxx}{ path-io } \
{hxx cxx}{ prerequisite } \
{hxx cxx}{ rule } \
{hxx }{ rule-map } \
diff --git a/build2/cli/module.cxx b/build2/cli/module.cxx
index 85c8f68..e4f2716 100644
--- a/build2/cli/module.cxx
+++ b/build2/cli/module.cxx
@@ -32,7 +32,7 @@ namespace build2
cli_init (scope& root,
scope& base,
const location& loc,
- std::unique_ptr<module>&,
+ unique_ptr<module>&,
bool first,
bool optional)
{
diff --git a/build2/cli/rule b/build2/cli/rule
index 0b76263..4f8ebc2 100644
--- a/build2/cli/rule
+++ b/build2/cli/rule
@@ -5,6 +5,9 @@
#ifndef BUILD2_CLI_RULE
#define BUILD2_CLI_RULE
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/rule>
namespace build2
@@ -15,7 +18,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 5cf9390..edd8bc8 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -6,7 +6,6 @@
#include <butl/process>
-#include <build2/types>
#include <build2/scope>
#include <build2/target>
#include <build2/context>
@@ -48,7 +47,7 @@ namespace build2
}
match_result compile::
- match (action a, target& xt, const std::string&) const
+ match (action a, target& xt, const string&) const
{
tracer trace ("cli::compile::match");
diff --git a/build2/cli/target b/build2/cli/target
index 4d8e903..065639b 100644
--- a/build2/cli/target
+++ b/build2/cli/target
@@ -5,6 +5,9 @@
#ifndef BUILD2_CLI_TARGET
#define BUILD2_CLI_TARGET
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
#include <build2/cxx/target>
diff --git a/build2/config/module.cxx b/build2/config/module.cxx
index d3fb45b..11b7aa1 100644
--- a/build2/config/module.cxx
+++ b/build2/config/module.cxx
@@ -54,7 +54,7 @@ namespace build2
config_init (scope& root,
scope&,
const location& l,
- std::unique_ptr<module>&,
+ unique_ptr<module>&,
bool first,
bool)
{
diff --git a/build2/config/operation b/build2/config/operation
index 0a89694..ad010df 100644
--- a/build2/config/operation
+++ b/build2/config/operation
@@ -5,6 +5,9 @@
#ifndef BUILD2_CONFIG_OPERATION
#define BUILD2_CONFIG_OPERATION
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
diff --git a/build2/config/utility b/build2/config/utility
index 95ec258..2f53521 100644
--- a/build2/config/utility
+++ b/build2/config/utility
@@ -5,11 +5,9 @@
#ifndef BUILD2_CONFIG_UTILITY
#define BUILD2_CONFIG_UTILITY
-#include <string>
-#include <utility> // pair
-#include <functional> // reference_wrapper
-
#include <build2/types>
+#include <build2/utility>
+
#include <build2/variable>
#include <build2/diagnostics>
@@ -29,29 +27,29 @@ namespace build2
// whether the variable has actually been set.
//
template <typename T>
- std::pair<std::reference_wrapper<const value>, bool>
+ pair<reference_wrapper<const value>, bool>
required (scope& root,
const variable&,
const T& default_value,
bool override = false);
template <typename T>
- inline std::pair<std::reference_wrapper<const value>, bool>
+ inline pair<reference_wrapper<const value>, bool>
required (scope& root,
- const std::string& name,
+ const string& name,
const T& default_value,
bool override = false)
{
return required (root, var_pool.find (name), default_value, override);
}
- inline std::pair<std::reference_wrapper<const value>, bool>
+ inline pair<reference_wrapper<const value>, bool>
required (scope& root,
- const std::string& name,
+ const string& name,
const char* default_value,
bool override = false)
{
- return required (root, name, std::string (default_value), override);
+ return required (root, name, string (default_value), override);
}
// Set, if necessary, an optional config.* variable. In particular,
@@ -65,7 +63,7 @@ namespace build2
optional (scope& root, const variable&);
inline const value&
- optional (scope& root, const std::string& var)
+ optional (scope& root, const string& var)
{
return optional (root, var_pool.find (var));
}
@@ -78,7 +76,7 @@ namespace build2
optional_absolute (scope& root, const variable&);
inline const value&
- optional_absolute (scope& root, const std::string& var)
+ optional_absolute (scope& root, const string& var)
{
return optional_absolute (root, var_pool.find (var));
}
@@ -95,7 +93,7 @@ namespace build2
// "remember" that it is unconfigured.
//
bool
- specified (scope& root, const std::string& ns);
+ specified (scope& root, const string& ns);
// @@ Why are these here?
//
diff --git a/build2/config/utility.txx b/build2/config/utility.txx
index 3fc40c0..fd32599 100644
--- a/build2/config/utility.txx
+++ b/build2/config/utility.txx
@@ -9,10 +9,10 @@ namespace build2
namespace config
{
template <typename T>
- std::pair<std::reference_wrapper<const value>, bool>
+ pair<reference_wrapper<const value>, bool>
required (scope& root, const variable& var, const T& def_value, bool ovr)
{
- using result = std::pair<std::reference_wrapper<const value>, bool>;
+ using result = pair<reference_wrapper<const value>, bool>;
if (auto l = root[var])
{
@@ -32,7 +32,7 @@ namespace build2
{
if (auto l = s[var])
{
- for (const std::string& s: as<strings> (*l))
+ for (const string& s: as<strings> (*l))
{
if (s == option)
return true;
diff --git a/build2/context b/build2/context
index e2732db..d7ca3d3 100644
--- a/build2/context
+++ b/build2/context
@@ -5,14 +5,11 @@
#ifndef BUILD2_CONTEXT
#define BUILD2_CONTEXT
-#include <string>
-#include <ostream>
-#include <cstdint> // uint64_t
-
#include <butl/filesystem>
#include <build2/types>
#include <build2/utility>
+
#include <build2/operation>
namespace build2
@@ -40,7 +37,7 @@ namespace build2
// execution with the expectation of it reaching 0. Used as a sanity
// check.
//
- extern std::uint64_t dependency_count;
+ extern uint64_t dependency_count;
// Reset the dependency state. In particular, this removes all the
// targets, scopes, and variable names.
@@ -135,13 +132,13 @@ namespace build2
// In addition to calling relative(), this function also uses shorter
// notations such as '~/'.
//
- std::string
+ string
diag_relative (const path&);
// As above but also adds trailing '/'. If the path is the same as
// base, returns "./" if current is true and empty string otherwise.
//
- std::string
+ string
diag_relative (const dir_path&, bool current = true);
// Action phrases, e.g., "configure update exe{foo}", "updating exe{foo}",
diff --git a/build2/context.cxx b/build2/context.cxx
index d8921e4..2abe2f0 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -4,10 +4,6 @@
#include <build2/context>
-#include <ostream>
-#include <cassert>
-#include <system_error>
-
#include <build2/scope>
#include <build2/target>
#include <build2/rule>
@@ -194,7 +190,7 @@ namespace build2
{
butl::rmdir_r (d);
}
- catch (const std::system_error& e)
+ catch (const system_error& e)
{
fail << "unable to remove directory " << d << ": " << e.what ();
}
diff --git a/build2/context.txx b/build2/context.txx
index 0ee470f..566beb1 100644
--- a/build2/context.txx
+++ b/build2/context.txx
@@ -2,8 +2,6 @@
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <system_error>
-
#include <build2/diagnostics>
namespace build2
@@ -25,7 +23,7 @@ namespace build2
{
rs = try_rmfile (f);
}
- catch (const std::system_error& e)
+ catch (const system_error& e)
{
if (verb >= 2)
text << "rm " << f;
@@ -64,7 +62,7 @@ namespace build2
{
rs = !w ? try_rmdir (d) : rmdir_status::not_empty;
}
- catch (const std::system_error& e)
+ catch (const system_error& e)
{
if (verb >= 2)
text << "rmdir " << d;
diff --git a/build2/cxx/compile b/build2/cxx/compile
index cfef0c4..5134e78 100644
--- a/build2/cxx/compile
+++ b/build2/cxx/compile
@@ -6,6 +6,8 @@
#define BUILD2_CXX_COMPILE
#include <build2/types>
+#include <build2/utility>
+
#include <build2/rule>
namespace build2
@@ -16,7 +18,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index b924aa2..a1abfcb 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -5,17 +5,12 @@
#include <build2/cxx/compile>
#include <map>
-#include <string>
-#include <cstddef> // size_t
#include <cstdlib> // exit()
-#include <utility> // move()
#include <butl/process>
-#include <butl/utility> // reverse_iterate
#include <butl/fdstream>
#include <butl/path-map>
-#include <build2/types>
#include <build2/scope>
#include <build2/variable>
#include <build2/algorithm>
diff --git a/build2/cxx/install b/build2/cxx/install
index cfec3da..119ef94 100644
--- a/build2/cxx/install
+++ b/build2/cxx/install
@@ -6,6 +6,8 @@
#define BUILD2_CXX_INSTALL
#include <build2/types>
+#include <build2/utility>
+
#include <build2/install/rule>
namespace build2
@@ -19,7 +21,7 @@ namespace build2
filter (action, target&, prerequisite_member) const;
virtual match_result
- match (action, target&, const std::string&) const;
+ match (action, target&, const string&) const;
static install instance;
};
diff --git a/build2/cxx/install.cxx b/build2/cxx/install.cxx
index aa097d7..f6f502a 100644
--- a/build2/cxx/install.cxx
+++ b/build2/cxx/install.cxx
@@ -49,7 +49,7 @@ namespace build2
}
match_result install::
- match (action a, target& t, const std::string& hint) const
+ match (action a, target& t, const string& hint) const
{
// @@ How do we split the hint between the two?
//
diff --git a/build2/cxx/link b/build2/cxx/link
index b39e16c..cfa6343 100644
--- a/build2/cxx/link
+++ b/build2/cxx/link
@@ -5,11 +5,9 @@
#ifndef BUILD2_CXX_LINK
#define BUILD2_CXX_LINK
-#include <vector>
-
-#include <butl/optional>
-
#include <build2/types>
+#include <build2/utility>
+
#include <build2/rule>
#include <build2/bin/target>
@@ -22,7 +20,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -55,8 +53,8 @@ namespace build2
private:
friend class compile;
- using search_paths = std::vector<dir_path>;
- using search_paths_cache = butl::optional<search_paths>;
+ using search_paths = vector<dir_path>;
+ using search_paths_cache = optional<search_paths>;
static target*
search_library (search_paths_cache&, prerequisite&);
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index 7e0ff71..42b2235 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -4,20 +4,14 @@
#include <build2/cxx/link>
-#include <vector>
-#include <string>
-#include <cstddef> // size_t
#include <cstdlib> // exit()
-#include <utility> // move()
#include <butl/process>
-#include <butl/utility> // reverse_iterate
#include <butl/fdstream>
#include <butl/optional>
#include <butl/path-map>
#include <butl/filesystem>
-#include <build2/types>
#include <build2/scope>
#include <build2/variable>
#include <build2/algorithm>
diff --git a/build2/cxx/module.cxx b/build2/cxx/module.cxx
index 6f2a891..f615129 100644
--- a/build2/cxx/module.cxx
+++ b/build2/cxx/module.cxx
@@ -33,7 +33,7 @@ namespace build2
cxx_init (scope& r,
scope& b,
const location& loc,
- std::unique_ptr<module>&,
+ unique_ptr<module>&,
bool first,
bool)
{
diff --git a/build2/cxx/target b/build2/cxx/target
index 9d3df4b..d9a4ed6 100644
--- a/build2/cxx/target
+++ b/build2/cxx/target
@@ -5,6 +5,9 @@
#ifndef BUILD2_CXX_TARGET
#define BUILD2_CXX_TARGET
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
namespace build2
diff --git a/build2/cxx/utility b/build2/cxx/utility
index d8b9fc1..7072c7b 100644
--- a/build2/cxx/utility
+++ b/build2/cxx/utility
@@ -5,9 +5,9 @@
#ifndef BUILD2_CXX_UTILITY
#define BUILD2_CXX_UTILITY
-#include <string>
-
#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
#include <build2/config/utility>
@@ -22,7 +22,7 @@ namespace build2
//
template <typename T>
void
- append_std (cstrings& args, T&, std::string& storage);
+ append_std (cstrings& args, T&, string& storage);
// Append library options from one of the cxx.export.* variables
// recursively, prerequisite libraries first.
diff --git a/build2/cxx/utility.txx b/build2/cxx/utility.txx
index 2d85b1b..8324107 100644
--- a/build2/cxx/utility.txx
+++ b/build2/cxx/utility.txx
@@ -10,11 +10,11 @@ namespace build2
{
template <typename T>
void
- append_std (cstrings& args, T& t, std::string& s)
+ append_std (cstrings& args, T& t, string& s)
{
if (auto l = t["cxx.std"])
{
- const std::string& v (as<string> (*l));
+ const string& v (as<string> (*l));
// Translate 11 to 0x and 14 to 1y for compatibility with
// older versions of the compiler.
diff --git a/build2/diagnostics b/build2/diagnostics
index 27c71fa..5ad6809 100644
--- a/build2/diagnostics
+++ b/build2/diagnostics
@@ -5,19 +5,11 @@
#ifndef BUILD2_DIAGNOSTICS
#define BUILD2_DIAGNOSTICS
-#include <cstddef> // size_t
-#include <cstdint>
-#include <utility>
-#include <cassert>
#include <sstream>
-#include <ostream>
-#include <exception>
#include <type_traits>
-#include <butl/path>
-
#include <build2/types>
-#include <build2/path-io>
+#include <build2/utility>
namespace build2
{
@@ -39,10 +31,10 @@ namespace build2
// nameN arg arg ... nullptr nullptr
//
void
- print_process (diag_record&, const char* const* args, std::size_t n = 0);
+ print_process (diag_record&, const char* const* args, size_t n = 0);
void
- print_process (const char* const* args, std::size_t n = 0);
+ print_process (const char* const* args, size_t n = 0);
inline void
print_process (diag_record& dr, const cstrings& args)
@@ -105,21 +97,21 @@ namespace build2
extern const int stream_verb_index;
inline uint16_t
- stream_verb (std::ostream& os)
+ stream_verb (ostream& os)
{
uint16_t v (static_cast<uint16_t> (os.iword (stream_verb_index)));
return v == 0 ? stream_verb_max : v - 1;
}
inline void
- stream_verb (std::ostream& os, uint16_t v)
+ stream_verb (ostream& os, uint16_t v)
{
os.iword (stream_verb_index) = static_cast<long> (v + 1);
}
// Diagnostic facility, base infrastructure (potentially reusable).
//
- extern std::ostream* diag_stream;
+ extern ostream* diag_stream;
template <typename> struct diag_prologue;
template <typename> struct diag_mark;
@@ -171,7 +163,7 @@ namespace build2
@@ libstdc++ doesn't yet have the ostringstream move support.
diag_record (diag_record&& r)
- : os_ (std::move (r.os_))
+ : os_ (move (r.os_))
{
empty_ = r.empty_;
r.empty_ = true;
@@ -216,11 +208,11 @@ namespace build2
template <typename... A>
diag_prologue (A&&... a)
- : B (std::forward<A> (a)...), epilogue_ (nullptr) {}
+ : B (forward<A> (a)...), epilogue_ (nullptr) {}
template <typename... A>
diag_prologue (diag_epilogue e, A&&... a)
- : B (std::forward<A> (a)...), epilogue_ (e) {}
+ : B (forward<A> (a)...), epilogue_ (e) {}
template <typename T>
diag_record
@@ -251,7 +243,7 @@ namespace build2
diag_mark (): B () {}
template <typename... A>
- diag_mark (A&&... a): B (std::forward<A> (a)...) {}
+ diag_mark (A&&... a): B (forward<A> (a)...) {}
template <typename T>
diag_record
@@ -291,12 +283,12 @@ namespace build2
// Note that location maintains a shallow reference to path.
//
location (): file (nullptr), line (0), column (0) {}
- location (const path* f, std::uint64_t l, std::uint64_t c)
+ location (const path* f, uint64_t l, uint64_t c)
: file (f), line (l), column (c) {}
const path* file;
- std::uint64_t line;
- std::uint64_t column;
+ uint64_t line;
+ uint64_t column;
};
struct location_prologue_base
diff --git a/build2/diagnostics.cxx b/build2/diagnostics.cxx
index fb108dc..d6278a8 100644
--- a/build2/diagnostics.cxx
+++ b/build2/diagnostics.cxx
@@ -7,8 +7,6 @@
#include <cstring> // strchr()
#include <iostream>
-#include <build2/utility>
-
using namespace std;
namespace build2
@@ -81,7 +79,7 @@ namespace build2
//
if (!empty_ && (!std::uncaught_exception () || exception_unwinding_dtor))
{
- *diag_stream << os_.str () << std::endl;
+ *diag_stream << os_.str () << endl;
if (epilogue_ != nullptr)
epilogue_ (*this); // Can throw.
diff --git a/build2/dist/module.cxx b/build2/dist/module.cxx
index 6dd1453..c7c3a23 100644
--- a/build2/dist/module.cxx
+++ b/build2/dist/module.cxx
@@ -88,9 +88,7 @@ namespace build2
// must be explicitly specified or we will complain if and when
// we try to dist.
//
- using namespace config;
-
- bool s (specified (r, "config.dist"));
+ bool s (config::specified (r, "config.dist"));
// dist.root
//
@@ -99,7 +97,7 @@ namespace build2
if (s)
{
- const value& cv (optional_absolute (r, "config.dist.root"));
+ const value& cv (config::optional_absolute (r, "config.dist.root"));
if (cv && !cv.empty ())
v = cv;
@@ -113,7 +111,8 @@ namespace build2
if (s)
{
- const value& cv (required (r, "config.dist.cmd", "install").first);
+ const value& cv (
+ config::required (r, "config.dist.cmd", "install").first);
if (cv && !cv.empty ())
v = cv;
@@ -129,7 +128,7 @@ namespace build2
if (s)
{
- const value& cv (optional (r, "config.dist.archives"));
+ const value& cv (config::optional (r, "config.dist.archives"));
if (cv && !cv.empty ())
v = cv;
diff --git a/build2/dist/operation b/build2/dist/operation
index e00da8a..741b47e 100644
--- a/build2/dist/operation
+++ b/build2/dist/operation
@@ -5,6 +5,9 @@
#ifndef BUILD2_DIST_OPERATION
#define BUILD2_DIST_OPERATION
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index f5b99fc..fba0ab5 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -4,8 +4,6 @@
#include <build2/dist/operation>
-#include <cassert>
-
#include <butl/process>
#include <butl/filesystem>
diff --git a/build2/dist/rule b/build2/dist/rule
index e460e66..f428ff2 100644
--- a/build2/dist/rule
+++ b/build2/dist/rule
@@ -5,8 +5,10 @@
#ifndef BUILD2_DIST_RULE
#define BUILD2_DIST_RULE
-#include <build2/rule>
#include <build2/types>
+#include <build2/utility>
+
+#include <build2/rule>
#include <build2/target>
#include <build2/operation>
@@ -18,7 +20,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string&) const;
+ match (action, target&, const string&) const;
virtual recipe
apply (action, target&, const match_result&) const;
diff --git a/build2/dist/rule.cxx b/build2/dist/rule.cxx
index f3d37eb..f3a99f9 100644
--- a/build2/dist/rule.cxx
+++ b/build2/dist/rule.cxx
@@ -16,7 +16,7 @@ namespace build2
namespace dist
{
match_result rule::
- match (action, target& t, const std::string&) const
+ match (action, target& t, const string&) const
{
return t; // We always match.
}
diff --git a/build2/dump b/build2/dump
index 6481bc9..264a1a6 100644
--- a/build2/dump
+++ b/build2/dump
@@ -5,6 +5,9 @@
#ifndef BUILD2_DUMP
#define BUILD2_DUMP
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
diff --git a/build2/dump.cxx b/build2/dump.cxx
index b3d78bb..13accf7 100644
--- a/build2/dump.cxx
+++ b/build2/dump.cxx
@@ -4,9 +4,6 @@
#include <build2/dump>
-#include <string>
-#include <cassert>
-
#include <build2/scope>
#include <build2/target>
#include <build2/variable>
diff --git a/build2/file b/build2/file
index 5a97f21..4f8c8db 100644
--- a/build2/file
+++ b/build2/file
@@ -6,9 +6,10 @@
#define BUILD2_FILE
#include <map>
-#include <string>
#include <build2/types>
+#include <build2/utility>
+
#include <build2/scope>
#include <build2/variable> // list_value
@@ -18,7 +19,7 @@ namespace build2
class location;
class prerequisite_key;
- using subprojects = std::map<std::string, dir_path>;
+ using subprojects = std::map<string, dir_path>;
extern const dir_path build_dir; // build
extern const dir_path bootstrap_dir; // build/bootstrap
diff --git a/build2/file.cxx b/build2/file.cxx
index 45c3a5e..0184ece 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -5,8 +5,6 @@
#include <build2/file>
#include <fstream>
-#include <utility> // move()
-#include <system_error>
#include <butl/filesystem>
diff --git a/build2/install/operation b/build2/install/operation
index daf7c40..8c93627 100644
--- a/build2/install/operation
+++ b/build2/install/operation
@@ -5,6 +5,9 @@
#ifndef BUILD2_INSTALL_OPERATION
#define BUILD2_INSTALL_OPERATION
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
diff --git a/build2/install/rule b/build2/install/rule
index 7a5f910..9602190 100644
--- a/build2/install/rule
+++ b/build2/install/rule
@@ -5,8 +5,10 @@
#ifndef BUILD2_INSTALL_RULE
#define BUILD2_INSTALL_RULE
-#include <build2/rule>
#include <build2/types>
+#include <build2/utility>
+
+#include <build2/rule>
#include <build2/target>
#include <build2/operation>
@@ -18,7 +20,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string&) const;
+ match (action, target&, const string&) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -28,7 +30,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string&) const;
+ match (action, target&, const string&) const;
// Return NULL if this prerequisite should be ignored and pointer to its
// target otherwise. The default implementation ignores prerequsites that
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 1b08b16..ae78981 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -41,7 +41,7 @@ namespace build2
// alias_rule
//
match_result alias_rule::
- match (action, target& t, const std::string&) const
+ match (action, target& t, const string&) const
{
return t;
}
@@ -84,7 +84,7 @@ namespace build2
//
match_result file_rule::
- match (action a, target& t, const std::string&) const
+ match (action a, target& t, const string&) const
{
// First determine if this target should be installed (called
// "installable" for short).
diff --git a/build2/install/utility b/build2/install/utility
index 98eca77..3d3b1a1 100644
--- a/build2/install/utility
+++ b/build2/install/utility
@@ -5,11 +5,10 @@
#ifndef BUILD2_INSTALL_UTILITY
#define BUILD2_INSTALL_UTILITY
-#include <string>
-#include <utility>
+#include <build2/types>
+#include <build2/utility>
#include <build2/scope>
-#include <build2/types>
namespace build2
{
@@ -23,16 +22,16 @@ namespace build2
{
auto r (s.target_vars[T::static_type]["*"].assign ("install"));
if (r.second) // Already set by the user?
- r.first.get () = std::move (d);
+ r.first.get () = move (d);
}
template <typename T>
inline void
- mode (scope& s, std::string m)
+ mode (scope& s, string m)
{
auto r (s.target_vars[T::static_type]["*"].assign ("install.mode"));
if (r.second) // Already set by the user?
- r.first.get () = std::move (m);
+ r.first.get () = move (m);
}
}
}
diff --git a/build2/lexer b/build2/lexer
index 0bbd22a..98feb75 100644
--- a/build2/lexer
+++ b/build2/lexer
@@ -6,12 +6,6 @@
#define BUILD2_LEXER
#include <stack>
-#include <string>
-#include <iosfwd>
-#include <cstddef> // size_t
-#include <cstdint> // uint64_t
-#include <cassert>
-#include <exception>
#include <butl/char-scanner>
@@ -43,7 +37,7 @@ namespace build2
class lexer: protected butl::char_scanner
{
public:
- lexer (std::istream& is,
+ lexer (istream& is,
const path& name,
void (*processor) (token&, const lexer&) = nullptr)
: char_scanner (is), fail (name), processor_ (processor), sep_ (false)
diff --git a/build2/module b/build2/module
index c9bc26c..7c8719e 100644
--- a/build2/module
+++ b/build2/module
@@ -66,7 +66,7 @@ namespace build2
//
bool
load_module (bool optional,
- const std::string& name,
+ const string& name,
scope& root,
scope& base,
const location&);
diff --git a/build2/module.cxx b/build2/module.cxx
index 05dbaa7..e05e22c 100644
--- a/build2/module.cxx
+++ b/build2/module.cxx
@@ -4,8 +4,6 @@
#include <build2/module>
-#include <utility> // make_pair()
-
#include <build2/scope>
#include <build2/variable>
#include <build2/diagnostics>
diff --git a/build2/name.cxx b/build2/name.cxx
index a64bb54..8ba9576 100644
--- a/build2/name.cxx
+++ b/build2/name.cxx
@@ -4,8 +4,6 @@
#include <build2/name>
-#include <ostream>
-
#include <build2/diagnostics>
using namespace std;
diff --git a/build2/operation b/build2/operation
index c5af3ed..688663b 100644
--- a/build2/operation
+++ b/build2/operation
@@ -5,15 +5,10 @@
#ifndef BUILD2_OPERATION
#define BUILD2_OPERATION
-#include <string>
-#include <iosfwd>
-#include <vector>
-#include <cstdint>
-#include <functional> // reference_wrapper
-
#include <butl/string-table>
#include <build2/types>
+#include <build2/utility>
namespace build2
{
@@ -29,9 +24,9 @@ namespace build2
//
// Note that 0 is not a valid meta/operation/action id.
//
- using meta_operation_id = std::uint8_t;
- using operation_id = std::uint8_t;
- using action_id = std::uint8_t;
+ using meta_operation_id = uint8_t;
+ using operation_id = uint8_t;
+ using action_id = uint8_t;
// Meta-operations and operations are not the end of the story. We
// also have operation nesting (currently only one level deep) which
@@ -99,8 +94,8 @@ namespace build2
inline bool
operator!= (action x, action y) {return !(x == y);}
- std::ostream&
- operator<< (std::ostream&, action);
+ ostream&
+ operator<< (ostream&, action);
// Id constants for build-in and pre-defined meta/operations.
//
@@ -175,18 +170,18 @@ namespace build2
// Normally a list of resolved and matched targets to execute. But
// can be something else, depending on the meta-operation.
//
- typedef std::vector<void*> action_targets;
+ typedef vector<void*> action_targets;
struct meta_operation_info
{
- const std::string name;
+ const string name;
// Name derivatives for diagnostics. If empty, then the meta-
// operation need not be mentioned.
//
- const std::string name_do; // E.g., [to] 'configure'.
- const std::string name_doing; // E.g., [while] 'configuring'.
- const std::string name_done; // E.g., 'is configured'.
+ const string name_do; // E.g., [to] 'configure'.
+ const string name_doing; // E.g., [while] 'configuring'.
+ const string name_done; // E.g., 'is configured'.
// If operation_pre() is not NULL, then it may translate default_id
// (and only default_id) to some other operation. If not translated,
@@ -258,7 +253,7 @@ namespace build2
//
struct operation_info
{
- const std::string name;
+ const string name;
// Name derivatives for diagnostics. Note that unlike meta-operations,
// these can only be empty for the default operation (id 1), And
@@ -266,9 +261,9 @@ namespace build2
// have empty derivatives (failed which only target name will be
// printed).
//
- const std::string name_do; // E.g., [to] 'update'.
- const std::string name_doing; // E.g., [while] 'updating'.
- const std::string name_done; // E.g., 'is up to date'.
+ const string name_do; // E.g., [to] 'update'.
+ const string name_doing; // E.g., [while] 'updating'.
+ const string name_done; // E.g., 'is up to date'.
const execution_mode mode;
@@ -317,7 +312,7 @@ namespace build2
template <typename T>
struct sparse_vector
{
- using base_type = std::vector<T*>;
+ using base_type = vector<T*>;
using size_type = typename base_type::size_type;
void
diff --git a/build2/operation.cxx b/build2/operation.cxx
index adeda32..77350e8 100644
--- a/build2/operation.cxx
+++ b/build2/operation.cxx
@@ -4,13 +4,6 @@
#include <build2/operation>
-#include <vector>
-#include <ostream>
-#include <cassert>
-#include <functional> // reference_wrapper
-
-#include <butl/utility> // reverse_iterate
-
#include <build2/scope>
#include <build2/target>
#include <build2/file>
diff --git a/build2/parser b/build2/parser
index ae3add9..5eb50e5 100644
--- a/build2/parser
+++ b/build2/parser
@@ -5,9 +5,6 @@
#ifndef BUILD2_PARSER
#define BUILD2_PARSER
-#include <string>
-#include <iosfwd>
-
#include <build2/types>
#include <build2/utility>
@@ -36,20 +33,19 @@ namespace build2
// Issue diagnostics and throw failed in case of an error.
//
void
- parse_buildfile (std::istream&, const path& name,
- scope& root, scope& base);
+ parse_buildfile (istream&, const path& name, scope& root, scope& base);
buildspec
- parse_buildspec (std::istream&, const path& name);
+ parse_buildspec (istream&, const path& name);
token
- parse_variable (lexer&, scope&, std::string var_name, token_type kind);
+ parse_variable (lexer&, scope&, string var_name, token_type kind);
names_type
- parse_export_stub (std::istream& is, const path& p, scope& r, scope& b)
+ parse_export_stub (istream& is, const path& p, scope& r, scope& b)
{
parse_buildfile (is, p, r, b);
- return std::move (export_value_);
+ return move (export_value_);
}
// Recursive descent parser.
@@ -83,9 +79,9 @@ namespace build2
if_else (token&, token_type&);
void
- variable (token&, token_type&, std::string name, token_type kind);
+ variable (token&, token_type&, string name, token_type kind);
- std::string
+ string
variable_name (names_type&&, const location&);
names_type
@@ -119,18 +115,18 @@ namespace build2
names (token&, token_type&,
names_type&,
bool chunk,
- std::size_t pair,
- const std::string* prj,
+ size_t pair,
+ const string* prj,
const dir_path* dir,
- const std::string* type);
+ const string* type);
size_t
names_trailer (token&, token_type&,
names_type&,
size_t pair,
- const std::string* prj,
+ const string* prj,
const dir_path* dir,
- const std::string* type);
+ const string* type);
// Skip until newline or eos.
//
diff --git a/build2/parser.cxx b/build2/parser.cxx
index ad556ce..98ca30d 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -5,15 +5,9 @@
#include <build2/parser>
#include <cctype> // is{alpha alnum}()
-
-#include <memory> // unique_ptr
#include <fstream>
-#include <utility> // move()
-#include <iterator> // make_move_iterator()
#include <iostream>
-#include <build2/types>
-#include <build2/utility>
#include <build2/version>
#include <build2/scope>
diff --git a/build2/path-io b/build2/path-io
deleted file mode 100644
index b3b0587..0000000
--- a/build2/path-io
+++ /dev/null
@@ -1,26 +0,0 @@
-// file : build2/path-io -*- C++ -*-
-// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef BUILD2_PATH_IO
-#define BUILD2_PATH_IO
-
-#include <iosfwd>
-
-#include <butl/path>
-
-// Custom path IO.
-//
-namespace build2
-{
- using butl::path;
- using butl::dir_path;
-
- std::ostream&
- operator<< (std::ostream&, const path&);
-
- std::ostream&
- operator<< (std::ostream&, const dir_path&);
-}
-
-#endif // BUILD2_PATH_IO
diff --git a/build2/path-io.cxx b/build2/path-io.cxx
deleted file mode 100644
index 845b0a3..0000000
--- a/build2/path-io.cxx
+++ /dev/null
@@ -1,39 +0,0 @@
-// file : build2/path-io.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <build2/path-io>
-
-#include <ostream>
-
-#include <build2/context>
-#include <build2/diagnostics>
-
-using namespace std;
-
-namespace build2
-{
- ostream&
- operator<< (ostream& os, const path& p)
- {
- return os << (stream_verb (os) < 2 ? diag_relative (p) : p.string ());
- }
-
- ostream&
- operator<< (ostream& os, const dir_path& d)
- {
- if (stream_verb (os) < 2)
- os << diag_relative (d); // Adds trailing '/'.
- else
- {
- const string& s (d.string ());
-
- // Print the directory with trailing '/'.
- //
- if (!s.empty ())
- os << s << (dir_path::traits::is_separator (s.back ()) ? "" : "/");
- }
-
- return os;
- }
-}
diff --git a/build2/prerequisite b/build2/prerequisite
index 61be2cc..baaaf3f 100644
--- a/build2/prerequisite
+++ b/build2/prerequisite
@@ -6,15 +6,11 @@
#define BUILD2_PREREQUISITE
#include <set>
-#include <string>
-#include <iosfwd>
-#include <utility> // move
-#include <cassert>
-#include <functional> // reference_wrapper
#include <build2/types>
+#include <build2/utility>
+
#include <build2/target-key>
-#include <build2/utility> // extension_pool
#include <build2/diagnostics>
namespace build2
@@ -30,7 +26,7 @@ namespace build2
public:
typedef build2::scope scope_type;
- mutable const std::string* proj; // Can be NULL, from project_name_pool.
+ mutable const string* proj; // Can be NULL, from project_name_pool.
target_key tk;
mutable scope_type* scope; // Can be NULL if tk.dir is absolute.
};
@@ -45,8 +41,8 @@ namespace build2
return x.proj < y.proj || (x.proj == y.proj && x.tk < y.tk);
}
- std::ostream&
- operator<< (std::ostream&, const prerequisite_key&);
+ ostream&
+ operator<< (ostream&, const prerequisite_key&);
class prerequisite
{
@@ -55,26 +51,26 @@ namespace build2
typedef build2::target_type target_type_type;
typedef build2::scope scope_type;
- prerequisite (const std::string* p,
+ prerequisite (const string* p,
const target_type_type& t,
dir_path d,
- std::string n,
- const std::string* e,
+ string n,
+ const string* e,
scope_type& s)
: proj (p),
type (t),
- dir (std::move (d)),
- name (std::move (n)),
+ dir (move (d)),
+ name (move (n)),
ext (e),
scope (s),
target (nullptr) {}
public:
- const std::string* const proj; // NULL if not project-qualified.
+ const string* const proj; // NULL if not project-qualified.
const target_type_type& type;
const dir_path dir; // Normalized absolute or relative (to scope).
- const std::string name;
- const std::string* ext; // NULL if unspecified.
+ const string name;
+ const string* ext; // NULL if unspecified.
scope_type& scope;
target_type* target; // NULL if not yet resolved. Note that this should
// always be the "primary target", not a member of
@@ -103,8 +99,8 @@ namespace build2
return x.key () < y.key ();
}
- inline std::ostream&
- operator<< (std::ostream& os, const prerequisite& p)
+ inline ostream&
+ operator<< (ostream& os, const prerequisite& p)
{
return os << p.key ();
}
@@ -113,17 +109,17 @@ namespace build2
//
struct prerequisite_set: std::set<prerequisite>
{
- std::pair<prerequisite&, bool>
- insert (const std::string* proj,
+ pair<prerequisite&, bool>
+ insert (const string* proj,
const target_type&,
dir_path dir,
- std::string name,
- const std::string* ext,
+ string name,
+ const string* ext,
scope&,
tracer&);
- std::pair<prerequisite&, bool>
- insert (const std::string* proj, const target_key& tk, scope& s, tracer& t)
+ pair<prerequisite&, bool>
+ insert (const string* proj, const target_key& tk, scope& s, tracer& t)
{
return insert (proj, *tk.type, *tk.dir, *tk.name, tk.ext, s, t);
}
diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx
index fb432eb..2eccd7e 100644
--- a/build2/prerequisite.cxx
+++ b/build2/prerequisite.cxx
@@ -4,8 +4,6 @@
#include <build2/prerequisite>
-#include <ostream>
-
#include <build2/scope>
#include <build2/target> // target_type
#include <build2/context>
@@ -51,11 +49,11 @@ namespace build2
// prerequisite_set
//
auto prerequisite_set::
- insert (const std::string* proj,
+ insert (const string* proj,
const target_type& tt,
dir_path dir,
- std::string name,
- const std::string* ext,
+ string name,
+ const string* ext,
scope& s,
tracer& trace) -> pair<prerequisite&, bool>
{
diff --git a/build2/rule b/build2/rule
index 69aad7d..03e4bf2 100644
--- a/build2/rule
+++ b/build2/rule
@@ -5,10 +5,9 @@
#ifndef BUILD2_RULE
#define BUILD2_RULE
-#include <string>
-#include <cstddef> // nullptr_t
-
#include <build2/types>
+#include <build2/utility>
+
#include <build2/target>
#include <build2/operation>
@@ -39,7 +38,7 @@ namespace build2
action recipe_action = action (); // Used as recipe's action if set.
- match_result (std::nullptr_t v = nullptr): prerequisite (v), target (v) {}
+ match_result (nullptr_t v = nullptr): prerequisite (v), target (v) {}
match_result (prerequisite_type& p): prerequisite (&p), target (nullptr) {}
match_result (prerequisite_type* p): prerequisite (p), target (nullptr) {}
match_result (target_type& t): prerequisite (nullptr), target (&t) {}
@@ -50,7 +49,7 @@ namespace build2
match_result (target_type& t, bool v): bvalue (v), target (&t) {}
match_result (target_type& t, void* v): pvalue (v), target (&t) {}
match_result (target_type& t, const void* v): cpvalue (v), target (&t) {}
- match_result (target_type& t, std::nullptr_t v): pvalue (v), target (&t) {}
+ match_result (target_type& t, nullptr_t v): pvalue (v), target (&t) {}
explicit
operator bool () const
@@ -63,7 +62,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const = 0;
+ match (action, target&, const string& hint) const = 0;
virtual recipe
apply (action, target&, const match_result&) const = 0;
@@ -76,7 +75,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -91,7 +90,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -103,7 +102,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string& hint) const;
+ match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
@@ -123,7 +122,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target& t, const std::string&) const {return t;}
+ match (action, target& t, const string&) const {return t;}
virtual recipe
apply (action, target&, const match_result&) const {return noop_recipe;}
diff --git a/build2/rule-map b/build2/rule-map
index 06e00a3..fe126f5 100644
--- a/build2/rule-map
+++ b/build2/rule-map
@@ -6,14 +6,12 @@
#define BUILD2_RULE_MAP
#include <map>
-#include <vector>
-#include <string>
-#include <memory> // unique_ptr
-#include <functional> // reference_wrapper
#include <butl/prefix-map>
#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
@@ -22,8 +20,8 @@ namespace build2
using target_type_rule_map = std::map<
const target_type*,
- butl::prefix_map<std::string, // Rule hint.
- std::reference_wrapper<rule>, '.'>>;
+ butl::prefix_map<string, // Rule hint.
+ reference_wrapper<rule>, '.'>>;
// This is an "indexed map" with operation_id being the index. Entry
// with id 0 is a wildcard.
@@ -55,7 +53,7 @@ namespace build2
empty () const {return map_.empty ();}
private:
- std::vector<target_type_rule_map> map_;
+ vector<target_type_rule_map> map_;
};
// This is another indexed map but this time meta_operation_id is the
@@ -108,7 +106,7 @@ namespace build2
private:
meta_operation_id mid_;
operation_rule_map map_;
- std::unique_ptr<rule_map> next_;
+ unique_ptr<rule_map> next_;
};
}
diff --git a/build2/rule.cxx b/build2/rule.cxx
index f420529..c0a34f9 100644
--- a/build2/rule.cxx
+++ b/build2/rule.cxx
@@ -4,9 +4,6 @@
#include <build2/rule>
-#include <utility> // move()
-#include <system_error>
-
#include <butl/filesystem>
#include <build2/scope>
diff --git a/build2/scope b/build2/scope
index 192ba10..158f967 100644
--- a/build2/scope
+++ b/build2/scope
@@ -5,7 +5,6 @@
#ifndef BUILD2_SCOPE
#define BUILD2_SCOPE
-#include <functional> // function
#include <unordered_set>
#include <unordered_map>
@@ -96,7 +95,7 @@ namespace build2
}
build2::lookup<const value>
- operator[] (const std::string& name) const
+ operator[] (const string& name) const
{
return operator[] (var_pool.find (name));
}
@@ -142,7 +141,7 @@ namespace build2
assign (const variable& var) {return vars.assign (var).first.get ();}
value&
- assign (const std::string& name, const build2::value_type* type = nullptr)
+ assign (const string& name, const build2::value_type* type = nullptr)
{
return vars.assign (name, type).first.get ();
}
@@ -157,7 +156,7 @@ namespace build2
append (const variable&);
value&
- append (const std::string& name)
+ append (const string& name)
{
return append (var_pool.find (name));
}
diff --git a/build2/search b/build2/search
index c1a5c2b..df9b73f 100644
--- a/build2/search
+++ b/build2/search
@@ -6,6 +6,7 @@
#define BUILD2_SEARCH
#include <build2/types>
+#include <build2/utility>
namespace build2
{
diff --git a/build2/search.cxx b/build2/search.cxx
index 3df8877..a661474 100644
--- a/build2/search.cxx
+++ b/build2/search.cxx
@@ -4,9 +4,6 @@
#include <build2/search>
-#include <utility> // move()
-#include <cassert>
-
#include <butl/filesystem>
#include <build2/scope>
diff --git a/build2/spec b/build2/spec
index 3e3d420..5e02f46 100644
--- a/build2/spec
+++ b/build2/spec
@@ -5,12 +5,8 @@
#ifndef BUILD2_SPEC
#define BUILD2_SPEC
-#include <string>
-#include <vector>
-#include <iosfwd>
-#include <utility> // move()
-
#include <build2/types>
+#include <build2/utility>
namespace build2
{
@@ -19,43 +15,43 @@ namespace build2
typedef build2::name name_type;
explicit
- targetspec (name_type n): name (std::move (n)) {}
+ targetspec (name_type n): name (move (n)) {}
targetspec (dir_path sb, name_type n)
- : src_base (std::move (sb)), name (std::move (n)) {}
+ : src_base (move (sb)), name (move (n)) {}
dir_path src_base;
name_type name;
};
- struct opspec: std::vector<targetspec>
+ struct opspec: vector<targetspec>
{
opspec () = default;
- opspec (std::string n): name (std::move (n)) {}
+ opspec (string n): name (move (n)) {}
- std::string name;
+ string name;
};
- struct metaopspec: std::vector<opspec>
+ struct metaopspec: vector<opspec>
{
metaopspec () = default;
- metaopspec (std::string n): name (std::move (n)) {}
+ metaopspec (string n): name (move (n)) {}
- std::string name;
+ string name;
};
- typedef std::vector<metaopspec> buildspec;
+ typedef vector<metaopspec> buildspec;
- std::ostream&
- operator<< (std::ostream&, const targetspec&);
+ ostream&
+ operator<< (ostream&, const targetspec&);
- std::ostream&
- operator<< (std::ostream&, const opspec&);
+ ostream&
+ operator<< (ostream&, const opspec&);
- std::ostream&
- operator<< (std::ostream&, const metaopspec&);
+ ostream&
+ operator<< (ostream&, const metaopspec&);
- std::ostream&
- operator<< (std::ostream&, const buildspec&);
+ ostream&
+ operator<< (ostream&, const buildspec&);
}
#endif // BUILD2_SPEC
diff --git a/build2/spec.cxx b/build2/spec.cxx
index 3f02d87..27987ec 100644
--- a/build2/spec.cxx
+++ b/build2/spec.cxx
@@ -4,8 +4,6 @@
#include <build2/spec>
-#include <ostream>
-
#include <build2/context>
#include <build2/diagnostics>
diff --git a/build2/target b/build2/target
index b35efdf..5328bc4 100644
--- a/build2/target
+++ b/build2/target
@@ -6,19 +6,9 @@
#define BUILD2_TARGET
#include <map>
-#include <string>
-#include <vector>
-#include <memory> // unique_ptr
-#include <cstddef> // size_t
-#include <cstdint> // uint8_t
-#include <functional> // reference_wrapper
-#include <ostream>
-#include <cassert>
-#include <utility> // move(), forward(), declval()
-#include <iterator>
+#include <iterator> // tags, etc.
#include <type_traits>
-#include <butl/utility> // reverse_iterate()
#include <butl/multi-index> // map_iterator_adapter
#include <build2/types>
@@ -41,7 +31,7 @@ namespace build2
// Target state.
//
- enum class target_state: std::uint8_t
+ enum class target_state: uint8_t
{
// The order of the enumerators is arranged so that their integral
// values indicate whether one "overrides" the other in the merge
@@ -55,13 +45,13 @@ namespace build2
group // Target's state is the group's state.
};
- std::ostream&
- operator<< (std::ostream&, target_state);
+ ostream&
+ operator<< (ostream&, target_state);
inline target_state&
operator |= (target_state& l, target_state r)
{
- if (static_cast<std::uint8_t> (r) > static_cast<std::uint8_t> (l))
+ if (static_cast<uint8_t> (r) > static_cast<uint8_t> (l))
l = r;
return l;
@@ -81,7 +71,7 @@ namespace build2
// so it should match the group's state.
//
using recipe_function = target_state (action, target&);
- using recipe = std::function<recipe_function>;
+ using recipe = function<recipe_function>;
// Commonly-used recipes. The default recipe executes the action on
// all the prerequisites in a loop, skipping ignored. Specifically,
@@ -105,9 +95,9 @@ namespace build2
// Prerequisite references as used in the target::prerequisites list
// below.
//
- struct prerequisite_ref: std::reference_wrapper<prerequisite>
+ struct prerequisite_ref: reference_wrapper<prerequisite>
{
- typedef std::reference_wrapper<prerequisite> base;
+ typedef reference_wrapper<prerequisite> base;
using base::base;
@@ -127,7 +117,7 @@ namespace build2
struct group_view
{
target* const* members; // NULL means not yet known.
- std::size_t count;
+ size_t count;
};
// Target.
@@ -143,8 +133,8 @@ namespace build2
target (const target&) = delete;
target& operator= (const target&) = delete;
- target (dir_path d, std::string n, const std::string* e)
- : dir (std::move (d)), name (std::move (n)), ext (e) {}
+ target (dir_path d, string n, const string* e)
+ : dir (move (d)), name (move (n)), ext (e) {}
// Reset the target before matching a rule for it. The
// default implementation clears prerequisite_targets.
@@ -153,8 +143,8 @@ namespace build2
reset (action_type);
const dir_path dir; // Absolute and normalized.
- const std::string name;
- const std::string* ext; // Extension, NULL means unspecified,
+ const string name;
+ const string* ext; // Extension, NULL means unspecified,
// empty means no extension.
// Target group to which this target belongs, if any. Note that
@@ -250,7 +240,7 @@ namespace build2
// Prerequisites.
//
public:
- typedef std::vector<prerequisite_ref> prerequisites_type;
+ typedef vector<prerequisite_ref> prerequisites_type;
prerequisites_type prerequisites;
// Targets to which prerequisites resolve for this recipe. Note
@@ -263,7 +253,7 @@ namespace build2
// track of the action here since the targets will be updated
// if the recipe is updated, normally as part of rule::apply().
//
- typedef std::vector<target*> prerequisite_targets_type;
+ typedef vector<target*> prerequisite_targets_type;
prerequisite_targets_type prerequisite_targets;
// Check if there are any prerequisites, taking into account
@@ -290,7 +280,7 @@ namespace build2
operator[] (const variable&) const;
lookup<const value>
- operator[] (const std::string& name) const
+ operator[] (const string& name) const
{
return operator[] (var_pool.find (name));
}
@@ -302,7 +292,7 @@ namespace build2
assign (const variable& var) {return vars.assign (var).first;}
value&
- assign (const std::string& name) {return vars.assign (name).first;}
+ assign (const string& name) {return vars.assign (name).first;}
// Return a value suitable for appending. See class scope for
// details.
@@ -311,7 +301,7 @@ namespace build2
append (const variable&);
value&
- append (const std::string& name)
+ append (const string& name)
{
return append (var_pool.find (name));
}
@@ -338,7 +328,7 @@ namespace build2
// should have been decremented to 0 naturally, as part of the previous
// action execution.
//
- std::size_t dependents;
+ size_t dependents;
public:
action_type action; // Action this recipe is for.
@@ -380,8 +370,8 @@ namespace build2
recipe_type recipe_;
};
- std::ostream&
- operator<< (std::ostream&, const target&);
+ ostream&
+ operator<< (ostream&, const target&);
// A "range" that presents the prerequisites of a group and one of
// its members as one continuous sequence, or, in other words, as
@@ -490,7 +480,7 @@ namespace build2
reverse_iterator
rend () const {return reverse_iterator (begin ());}
- std::size_t
+ size_t
size () const
{
return t_.prerequisites.size () +
@@ -536,13 +526,13 @@ namespace build2
return target != nullptr ? target->type () : prerequisite.get ().type;
}
- const std::string&
+ const string&
name () const
{
return target != nullptr ? target->name : prerequisite.get ().name;
}
- const std::string*
+ const string*
proj () const
{
// Target cannot be project-qualified.
@@ -560,8 +550,8 @@ namespace build2
as_prerequisite (tracer&) const;
};
- inline std::ostream&
- operator<< (std::ostream& os, const prerequisite_member& pm)
+ inline ostream&
+ operator<< (ostream& os, const prerequisite_member& pm)
{
return os << pm.key ();
}
@@ -597,7 +587,7 @@ namespace build2
inline prerequisite_members_range<T>
prerequisite_members (action a, T&& x, bool members = true)
{
- return prerequisite_members_range<T> (a, std::forward<T> (x), members);
+ return prerequisite_members_range<T> (a, forward<T> (x), members);
}
template <typename T>
@@ -605,9 +595,9 @@ namespace build2
{
public:
prerequisite_members_range (action a, T&& r, bool m)
- : a_ (a), members_ (m), r_ (std::forward<T> (r)), e_ (r_.end ()) {}
+ : a_ (a), members_ (m), r_ (forward<T> (r)), e_ (r_.end ()) {}
- using base_iterator = decltype (std::declval<T> ().begin ());
+ using base_iterator = decltype (declval<T> ().begin ());
struct iterator
{
@@ -692,7 +682,7 @@ namespace build2
const prerequisite_members_range* r_;
base_iterator i_;
group_view g_;
- std::size_t j_; // 1-based index, to support enter_group().
+ size_t j_; // 1-based index, to support enter_group().
mutable std::aligned_storage<sizeof (prerequisite_member),
alignof (prerequisite_member)>::type m_;
};
@@ -724,7 +714,7 @@ namespace build2
reverse_prerequisite_members (action a, target& t, bool members = true)
{
return prerequisite_members (
- a, butl::reverse_iterate (t.prerequisites), members);
+ a, reverse_iterate (t.prerequisites), members);
}
// prerequisite_members(group_prerequisites (t))
@@ -741,7 +731,7 @@ namespace build2
reverse_group_prerequisite_members (action a, target& t, bool members = true)
{
return prerequisite_members (
- a, butl::reverse_iterate (group_prerequisites (t)), members);
+ a, reverse_iterate (group_prerequisites (t)), members);
}
//
@@ -750,7 +740,7 @@ namespace build2
{
// @@ When we update ext in key, don't we change it? I think we do.
//
- typedef std::map<target_key, std::unique_ptr<target>> map;
+ typedef std::map<target_key, unique_ptr<target>> map;
typedef butl::map_iterator_adapter<map::const_iterator> iterator;
iterator
@@ -759,8 +749,8 @@ namespace build2
iterator
find (const target_type& type,
const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
tracer& trace) const
{
return find (target_key {&type, &dir, &name, ext}, trace);
@@ -771,7 +761,7 @@ namespace build2
//
template <typename T>
T*
- find (const dir_path& dir, const std::string& name) const
+ find (const dir_path& dir, const string& name) const
{
auto i (map_.find (target_key {&T::static_type, &dir, &name, nullptr}));
return i != map_.end () ? static_cast<T*> (i->second.get ()) : nullptr;
@@ -780,18 +770,18 @@ namespace build2
iterator begin () const {return map_.begin ();}
iterator end () const {return map_.end ();}
- std::pair<target&, bool>
+ pair<target&, bool>
insert (const target_type&,
dir_path dir,
- std::string name,
- const std::string* ext,
+ string name,
+ const string* ext,
tracer&);
template <typename T>
T&
insert (const dir_path& dir,
- const std::string& name,
- const std::string* ext,
+ const string& name,
+ const string* ext,
tracer& t)
{
return static_cast<T&> (
@@ -800,7 +790,7 @@ namespace build2
template <typename T>
T&
- insert (const dir_path& dir, const std::string& name, tracer& t)
+ insert (const dir_path& dir, const string& name, tracer& t)
{
return static_cast<T&> (
insert (T::static_type, dir, name, nullptr, t).first);
@@ -877,7 +867,7 @@ namespace build2
path () const {return path_;}
void
- path (path_type p) {assert (path_.empty ()); path_ = std::move (p);}
+ path (path_type p) {assert (path_.empty ()); path_ = move (p);}
// Derive a path from target's dir, name, and, if set, ext. If ext is not
// set, try to derive it using the target type extension function and
@@ -1059,29 +1049,29 @@ namespace build2
// Return fixed target extension.
//
template <const char* ext>
- const std::string*
+ const string*
target_extension_fix (const target_key&, scope&);
// Get the extension from the variable or use the default if none set. If
// the default is NULL, then return NULL.
//
template <const char* var, const char* def>
- const std::string*
+ const string*
target_extension_var (const target_key&, scope&);
// Always return NULL extension.
//
- const std::string*
+ const string*
target_extension_null (const target_key&, scope&);
// Issue diagnostics and fail if called.
//
- const std::string*
+ const string*
target_extension_fail (const target_key&, scope&);
// Assert if called.
//
- const std::string*
+ const string*
target_extension_assert (const target_key&, scope&);
// Target print functions.
diff --git a/build2/target-key b/build2/target-key
index 1c8037c..bf88007 100644
--- a/build2/target-key
+++ b/build2/target-key
@@ -6,9 +6,6 @@
#define BUILD2_TARGET_KEY
#include <map>
-#include <string>
-#include <ostream>
-#include <functional> // reference_wrapper
#include <butl/utility> // compare_c_string
@@ -26,8 +23,8 @@ namespace build2
public:
const target_type* const type;
const dir_path* const dir;
- const std::string* const name;
- const std::string* const& ext;
+ const string* const name;
+ const string* const& ext;
friend bool
operator< (const target_key& x, const target_key& y)
diff --git a/build2/target-type b/build2/target-type
index 2659e3d..de210e1 100644
--- a/build2/target-type
+++ b/build2/target-type
@@ -6,8 +6,6 @@
#define BUILD2_TARGET_TYPE
#include <map>
-#include <string>
-#include <ostream>
#include <build2/types>
#include <build2/utility>
@@ -63,8 +61,8 @@ namespace build2
inline bool
operator!= (const target_type& x, const target_type& y) {return &x != &y;}
- inline std::ostream&
- operator<< (std::ostream& os, const target_type& tt) {return os << tt.name;}
+ inline ostream&
+ operator<< (ostream& os, const target_type& tt) {return os << tt.name;}
// Target type map.
//
diff --git a/build2/target.cxx b/build2/target.cxx
index 7a4913c..0a416bb 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -4,8 +4,6 @@
#include <build2/target>
-#include <cassert>
-
#include <butl/filesystem>
#include <build2/scope>
@@ -66,7 +64,7 @@ namespace build2
}
action = a;
- recipe_ = std::move (r);
+ recipe_ = move (r);
// Also reset the target state. If this is a noop recipe, then
// mark the target unchanged so that we don't waste time executing
@@ -566,7 +564,7 @@ namespace build2
false
};
- static const std::string*
+ static const string*
buildfile_target_extension (const target_key& tk, scope&)
{
// If the name is special 'buildfile', then there is no extension,
diff --git a/build2/test/module b/build2/test/module
index ba83c5b..8736851 100644
--- a/build2/test/module
+++ b/build2/test/module
@@ -6,6 +6,8 @@
#define BUILD2_TEST_MODULE
#include <build2/types>
+#include <build2/utility>
+
#include <build2/module>
namespace build2
diff --git a/build2/test/operation b/build2/test/operation
index 5dca166..9a7370e 100644
--- a/build2/test/operation
+++ b/build2/test/operation
@@ -5,6 +5,9 @@
#ifndef BUILD2_TEST_OPERATION
#define BUILD2_TEST_OPERATION
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/operation>
namespace build2
diff --git a/build2/test/rule b/build2/test/rule
index 7364bf6..8d18a35 100644
--- a/build2/test/rule
+++ b/build2/test/rule
@@ -5,6 +5,9 @@
#ifndef BUILD2_TEST_RULE
#define BUILD2_TEST_RULE
+#include <build2/types>
+#include <build2/utility>
+
#include <build2/rule>
#include <build2/operation>
@@ -16,7 +19,7 @@ namespace build2
{
public:
virtual match_result
- match (action, target&, const std::string&) const;
+ match (action, target&, const string&) const;
virtual recipe
apply (action, target&, const match_result&) const;
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index e5b8eb2..c7de054 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -21,7 +21,7 @@ namespace build2
namespace test
{
match_result rule::
- match (action a, target& t, const std::string&) const
+ match (action a, target& t, const string&) const
{
// First determine if this is a test. This is controlled by
// the test target variable and text.<tt> scope variables.
diff --git a/build2/token b/build2/token
index 5b75e1c..31e7baa 100644
--- a/build2/token
+++ b/build2/token
@@ -5,11 +5,8 @@
#ifndef BUILD2_TOKEN
#define BUILD2_TOKEN
-#include <string>
-#include <iosfwd>
-#include <cstddef> // size_t
-#include <cstdint> // uint64_t
-#include <utility> // move
+#include <build2/types>
+#include <build2/utility>
namespace build2
{
@@ -40,16 +37,16 @@ namespace build2
bool quoted; // Name (or some part of it) was quoted.
char pair; // Only valid for pair_separator.
- std::string value; // Only valid for name.
+ string value; // Only valid for name.
- std::uint64_t line;
- std::uint64_t column;
+ uint64_t line;
+ uint64_t column;
public:
- token (token_type t, bool s, std::uint64_t l, std::uint64_t c)
+ token (token_type t, bool s, uint64_t l, uint64_t c)
: type (t), separated (s), quoted (false), line (l), column (c) {}
- token (char p, bool s, std::uint64_t l, std::uint64_t c)
+ token (char p, bool s, uint64_t l, uint64_t c)
: type (token_type::pair_separator),
separated (s),
quoted (false),
@@ -57,19 +54,19 @@ namespace build2
line (l),
column (c) {}
- token (std::string n, bool s, bool q, std::uint64_t l, std::uint64_t c)
+ token (string n, bool s, bool q, uint64_t l, uint64_t c)
: type (token_type::name),
separated (s),
quoted (q),
- value (std::move (n)),
+ value (move (n)),
line (l),
column (c) {}
};
// Output the token value in a format suitable for diagnostics.
//
- std::ostream&
- operator<< (std::ostream&, const token&);
+ ostream&
+ operator<< (ostream&, const token&);
}
#endif // BUILD2_TOKEN
diff --git a/build2/token.cxx b/build2/token.cxx
index a80ff44..7a36a2d 100644
--- a/build2/token.cxx
+++ b/build2/token.cxx
@@ -4,8 +4,6 @@
#include <build2/token>
-#include <ostream>
-
using namespace std;
namespace build2
diff --git a/build2/types b/build2/types
index 35aaa58..0c34efb 100644
--- a/build2/types
+++ b/build2/types
@@ -5,16 +5,22 @@
#ifndef BUILD2_TYPES
#define BUILD2_TYPES
-#include <iosfwd> // ostream
#include <vector>
#include <string>
-#include <utility> // pair
-#include <memory> // unique_ptr, shared_ptr
-#include <cstddef> // size_t
-#include <cstdint> // uint{8,16,32,64}_t
-#include <functional> // reference_wrapper
+#include <memory> // unique_ptr, shared_ptr
+#include <utility> // pair
+#include <cstddef> // size_t, nullptr_t
+#include <cstdint> // uint{8,16,32,64}_t
+#include <istream>
+#include <ostream>
+#include <functional> // function, reference_wrapper
+
+#include <exception> // exception
+#include <stdexcept> // logic_error, invalid_argument, runtime_error
+#include <system_error>
#include <butl/path>
+#include <butl/optional>
#include <butl/timestamp>
#include <build2/name>
@@ -27,22 +33,40 @@ namespace build2
using std::uint16_t;
using std::uint32_t;
using std::uint64_t;
+
using std::size_t;
+ using std::nullptr_t;
using std::pair;
using std::string;
+ using std::function;
+ using std::reference_wrapper;
+
using std::unique_ptr;
using std::shared_ptr;
- using std::reference_wrapper;
+ using std::weak_ptr;
+
using std::vector;
using strings = vector<string>;
using cstrings = vector<const char*>;
- // <iosfwd>
- //
+ using std::istream;
using std::ostream;
+ // Exceptions. While <exception> is included, there is no using for
+ // std::exception -- use qualified.
+ //
+ using std::logic_error;
+ using std::invalid_argument;
+ using std::runtime_error;
+ using std::system_error;
+
+ // <butl/optional>
+ //
+ using butl::optional;
+ using butl::nullopt;
+
// <butl/path>
//
using butl::path;
@@ -53,6 +77,14 @@ namespace build2
using paths = std::vector<path>;
using dir_paths = std::vector<dir_path>;
+ // Custom path printing (implemented in utility.cxx).
+ //
+ ostream&
+ operator<< (ostream&, const path&);
+
+ ostream&
+ operator<< (ostream&, const dir_path&);
+
// <butl/timestamp>
//
using butl::system_clock;
@@ -61,6 +93,9 @@ namespace build2
using butl::timestamp_unknown;
using butl::timestamp_nonexistent;
using butl::operator<<;
+
+ // <build2/name>
+ //
}
#endif // BUILD2_TYPES
diff --git a/build2/utility b/build2/utility
index 9245d86..a61fb08 100644
--- a/build2/utility
+++ b/build2/utility
@@ -5,8 +5,14 @@
#ifndef BUILD2_UTILITY
#define BUILD2_UTILITY
-#include <utility> // move(), make_pair()
-#include <cassert> // assert()
+#include <memory> // make_shared()
+#include <string> // to_string()
+#include <utility> // move(), forward(), declval(), make_pair()
+#include <cassert> // assert()
+#include <iterator> // make_move_iterator()
+
+#include <butl/utility> // reverse_iterate()
+
#include <exception> // uncaught_exception()
#include <unordered_set>
@@ -15,7 +21,17 @@
namespace build2
{
using std::move;
+ using std::forward;
+ using std::declval;
+
using std::make_pair;
+ using std::make_shared;
+ using std::make_move_iterator;
+ using std::to_string;
+
+ // <butl/utility>
+ //
+ using butl::reverse_iterate;
// Empty string and path.
//
diff --git a/build2/utility.cxx b/build2/utility.cxx
index 3f078a7..b517deb 100644
--- a/build2/utility.cxx
+++ b/build2/utility.cxx
@@ -6,10 +6,45 @@
#include <cstdlib> // strtol()
+#include <build2/context>
+#include <build2/diagnostics>
+
using namespace std;
namespace build2
{
+ //
+ // <build2/types>
+ //
+
+ ostream&
+ operator<< (ostream& os, const path& p)
+ {
+ return os << (stream_verb (os) < 2 ? diag_relative (p) : p.string ());
+ }
+
+ ostream&
+ operator<< (ostream& os, const dir_path& d)
+ {
+ if (stream_verb (os) < 2)
+ os << diag_relative (d); // Adds trailing '/'.
+ else
+ {
+ const string& s (d.string ());
+
+ // Print the directory with trailing '/'.
+ //
+ if (!s.empty ())
+ os << s << (dir_path::traits::is_separator (s.back ()) ? "" : "/");
+ }
+
+ return os;
+ }
+
+ //
+ // <build2/utility>
+ //
+
const string empty_string;
const path empty_path;
const dir_path empty_dir_path;
diff --git a/build2/variable b/build2/variable
index 5ff310a..0c945c7 100644
--- a/build2/variable
+++ b/build2/variable
@@ -6,10 +6,7 @@
#define BUILD2_VARIABLE
#include <map>
-#include <vector>
-#include <cstddef> // nullptr_t
-#include <utility> // pair, make_pair()
-#include <iterator>
+#include <iterator> // tags, etc.
#include <functional> // hash
#include <type_traits> // conditional, is_reference, remove_reference, etc.
#include <unordered_set>
@@ -50,7 +47,7 @@ namespace build2
//
struct variable
{
- std::string name;
+ string name;
const value_type* type; // If NULL, then not (yet) typed.
variable_visibility visibility;
char pairs; // Pair symbold or '\0' if not used.
@@ -59,7 +56,7 @@ namespace build2
inline bool
operator== (const variable& x, const variable& y) {return x.name == y.name;}
- typedef std::reference_wrapper<const variable> variable_cref;
+ typedef reference_wrapper<const variable> variable_cref;
// value
//
@@ -74,7 +71,7 @@ namespace build2
value (value&&) = default;
value&
- operator= (std::nullptr_t)
+ operator= (nullptr_t)
{
data_.clear ();
state_ = state_type::null;
@@ -107,10 +104,10 @@ namespace build2
// Forwarded to the representation type's assign()/append() (see below).
//
template <typename T> value& operator= (T);
- value& operator= (const char* v) {return *this = std::string (v);}
+ value& operator= (const char* v) {return *this = string (v);}
template <typename T> value& operator+= (T);
- value& operator+= (const char* v) {return *this += std::string (v);}
+ value& operator+= (const char* v) {return *this += string (v);}
private:
explicit value (const value&) = default;
@@ -122,8 +119,8 @@ namespace build2
bool empty () const {return state_ == state_type::empty;}
explicit operator bool () const {return !null ();}
- bool operator== (std::nullptr_t) const {return null ();}
- bool operator!= (std::nullptr_t) const {return !null ();}
+ bool operator== (nullptr_t) const {return null ();}
+ bool operator!= (nullptr_t) const {return !null ();}
// Raw data read interface.
//
@@ -284,10 +281,10 @@ namespace build2
// string
//
template <>
- struct value_traits<std::string>
+ struct value_traits<string>
{
- using type = std::string&;
- using const_type = const std::string&;
+ using type = string&;
+ using const_type = const string&;
static type as (name& n) {return n.value;}
static const_type as (const name& n) {return n.value;}
@@ -296,8 +293,8 @@ namespace build2
static const_type as (const value&);
static bool assign (name&);
- static void assign (value&, std::string);
- static void append (value&, std::string);
+ static void assign (value&, string);
+ static void append (value&, string);
static const build2::value_type value_type;
};
@@ -392,10 +389,10 @@ namespace build2
public:
vector_value&
- operator= (std::vector<T> v) {assign (std::move (v)); return *this;}
+ operator= (vector<T> v) {assign (move (v)); return *this;}
vector_value&
- assign (std::vector<T>);
+ assign (vector<T>);
template <typename D1>
vector_value&
@@ -432,13 +429,13 @@ namespace build2
vector_value (vector_value&&) = default;
vector_value& operator= (vector_value&&) = default; //@@ TMP
- explicit vector_value (std::nullptr_t): d (nullptr) {} //@@ TMP
+ explicit vector_value (nullptr_t): d (nullptr) {} //@@ TMP
D* d; // names
};
template <typename T>
- struct value_traits<std::vector<T>>
+ struct value_traits<vector<T>>
{
using type = vector_value<T, names>;
using const_type = vector_value<T, const names>;
@@ -449,15 +446,15 @@ namespace build2
template <typename V> static void assign (value&, V);
template <typename V> static void append (value&, V);
- static const std::string type_name;
+ static const string type_name;
static const build2::value_type value_type;
};
template <typename T, typename D>
- struct value_traits<vector_value<T, D>>: value_traits<std::vector<T>> {};
+ struct value_traits<vector_value<T, D>>: value_traits<vector<T>> {};
- using strings_value = vector_value<std::string, names>;
- using const_strings_value = vector_value<std::string, const names>;
+ using strings_value = vector_value<string, names>;
+ using const_strings_value = vector_value<string, const names>;
extern const value_type* strings_type; // vector<string> aka strings
extern const value_type* dir_paths_type; // vector<dir_path> aka dir_paths
@@ -473,12 +470,12 @@ namespace build2
{
using first_type = typename std::conditional<
std::is_reference<F>::value,
- std::reference_wrapper<typename std::remove_reference<F>::type>,
+ reference_wrapper<typename std::remove_reference<F>::type>,
F>::type;
using second_type = typename std::conditional<
std::is_reference<S>::value,
- std::reference_wrapper<typename std::remove_reference<S>::type>,
+ reference_wrapper<typename std::remove_reference<S>::type>,
S>::type;
first_type first;
@@ -536,7 +533,7 @@ namespace build2
public:
map_value&
- operator= (std::map<K, V> m) {assign (std::move (m)); return *this;}
+ operator= (std::map<K, V> m) {assign (move (m)); return *this;}
map_value&
assign (std::map<K, V>);
@@ -579,7 +576,7 @@ namespace build2
template <typename M> static void assign (value&, M);
template <typename M> static void append (value&, M);
- static const std::string type_name;
+ static const string type_name;
static const build2::value_type value_type;
};
@@ -658,7 +655,7 @@ namespace build2
auto r (
insert (
variable {
- std::move (name),
+ move (name),
t,
vv != nullptr ? *vv : variable_visibility::normal,
p}));
@@ -742,7 +739,7 @@ namespace build2
}
lookup<const value>
- operator[] (const std::string& name) const
+ operator[] (const string& name) const
{
return operator[] (var_pool.find (name));
}
@@ -756,7 +753,7 @@ namespace build2
}
lookup<value>
- operator[] (const std::string& name)
+ operator[] (const string& name)
{
return operator[] (var_pool.find (name));
}
@@ -764,7 +761,7 @@ namespace build2
// The second member in the pair indicates whether the new
// value (which will be NULL) was assigned.
//
- std::pair<std::reference_wrapper<value>, bool>
+ pair<reference_wrapper<value>, bool>
assign (const variable& var)
{
auto r (m_.emplace (var, value (var.type)));
@@ -775,21 +772,20 @@ namespace build2
if (!r.second && var.type != nullptr && v.type != var.type)
build2::assign (v, var.type, var);
- return std::make_pair (std::reference_wrapper<value> (v), r.second);
+ return make_pair (reference_wrapper<value> (v), r.second);
}
- std::pair<std::reference_wrapper<value>, bool>
- assign (const std::string& name, const build2::value_type* type = nullptr)
+ pair<reference_wrapper<value>, bool>
+ assign (const string& name, const build2::value_type* type = nullptr)
{
return assign (var_pool.find (name, type));
}
- std::pair<const_iterator, const_iterator>
- find_namespace (const std::string& ns) const
+ pair<const_iterator, const_iterator>
+ find_namespace (const string& ns) const
{
auto r (m_.find_prefix (var_pool.find (ns)));
- return std::make_pair (const_iterator (r.first),
- const_iterator (r.second));
+ return make_pair (const_iterator (r.first), const_iterator (r.second));
}
const_iterator
@@ -815,9 +811,9 @@ namespace build2
// we "instantiate" the value on the fly, then we will need to
// consider its lifetime.
//
- using variable_pattern_map = std::map<std::string, variable_map>;
+ using variable_pattern_map = std::map<string, variable_map>;
- struct variable_type_map: std::map<std::reference_wrapper<const target_type>,
+ struct variable_type_map: std::map<reference_wrapper<const target_type>,
variable_pattern_map>
{
build2::lookup<const value>
diff --git a/build2/variable.cxx b/build2/variable.cxx
index 664b02e..39d8cdd 100644
--- a/build2/variable.cxx
+++ b/build2/variable.cxx
@@ -4,9 +4,6 @@
#include <build2/variable>
-#include <iterator> // make_move_iterator()
-
-#include <build2/utility>
#include <build2/diagnostics>
using namespace std;
@@ -196,7 +193,7 @@ namespace build2
//
if (n.directory ())
{
- n.value = std::move (n.dir).string (); // Move string out of path.
+ n.value = move (n.dir).string (); // Move string out of path.
// Add / back to the end of the path unless it is already there.
// Note that the string cannot be empty (n.directory () would
diff --git a/build2/variable.ixx b/build2/variable.ixx
index 52550e4..b368c6e 100644
--- a/build2/variable.ixx
+++ b/build2/variable.ixx
@@ -55,7 +55,7 @@ namespace build2
inline value& value::
operator= (T v)
{
- value_traits<T>::assign (*this, std::move (v));
+ value_traits<T>::assign (*this, move (v));
return *this;
}
@@ -63,14 +63,14 @@ namespace build2
inline value& value::
operator+= (T v)
{
- value_traits<T>::append (*this, std::move (v));
+ value_traits<T>::append (*this, move (v));
return *this;
}
inline void value::
assign (names v, const variable& var)
{
- data_ = std::move (v);
+ data_ = move (v);
state_ = (type != nullptr && type->assign != nullptr
? type->assign (data_, var)
: !data_.empty ())
@@ -120,22 +120,22 @@ namespace build2
// string value
//
- inline std::string& value_traits<std::string>::
+ inline string& value_traits<string>::
as (value& v)
{
assert (v.type == string_type);
return v.data_.front ().value;
}
- inline const std::string& value_traits<std::string>::
+ inline const string& value_traits<string>::
as (const value& v)
{
assert (v.type == string_type);
return v.data_.front ().value;
}
- inline void value_traits<std::string>::
- assign (value& v, std::string x)
+ inline void value_traits<string>::
+ assign (value& v, string x)
{
if (v.null ())
{
@@ -145,18 +145,18 @@ namespace build2
v.state_ = value::state_type::empty;
}
- v.state_ = (as (v) = std::move (x)).empty ()
+ v.state_ = (as (v) = move (x)).empty ()
? value::state_type::empty
: value::state_type::filled;
}
- inline void value_traits<std::string>::
- append (value& v, std::string x)
+ inline void value_traits<string>::
+ append (value& v, string x)
{
if (v.null ())
- assign (v, std::move (x));
+ assign (v, move (x));
else
- v.state_ = (as (v) += std::move (x)).empty ()
+ v.state_ = (as (v) += move (x)).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -188,7 +188,7 @@ namespace build2
v.state_ = value::state_type::empty;
}
- v.state_ = (as (v) = std::move (x)).empty ()
+ v.state_ = (as (v) = move (x)).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -197,9 +197,9 @@ namespace build2
append (value& v, dir_path x)
{
if (v.null ())
- assign (v, std::move (x));
+ assign (v, move (x));
else
- v.state_ = (as (v) /= std::move (x)).empty ()
+ v.state_ = (as (v) /= move (x)).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -231,7 +231,7 @@ namespace build2
v.state_ = value::state_type::empty;
}
- v.state_ = (as (v) = std::move (x)).empty ()
+ v.state_ = (as (v) = move (x)).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -240,12 +240,12 @@ namespace build2
//
template <typename T, typename D>
inline vector_value<T, D>& vector_value<T, D>::
- assign (std::vector<T> v)
+ assign (vector<T> v)
{
d->clear ();
d->insert (d->end (),
- std::make_move_iterator (v.begin ()),
- std::make_move_iterator (v.end ()));
+ make_move_iterator (v.begin ()),
+ make_move_iterator (v.end ()));
return *this;
}
@@ -269,47 +269,47 @@ namespace build2
}
template <typename T>
- inline vector_value<T, names> value_traits<std::vector<T>>::
+ inline vector_value<T, names> value_traits<vector<T>>::
as (value& v)
{
- assert (v.type == &value_traits<std::vector<T>>::value_type);
+ assert (v.type == &value_traits<vector<T>>::value_type);
return vector_value<T, names> (v.data_);
}
template <typename T>
- inline vector_value<T, const names> value_traits<std::vector<T>>::
+ inline vector_value<T, const names> value_traits<vector<T>>::
as (const value& v)
{
- assert (v.type == &value_traits<std::vector<T>>::value_type);
+ assert (v.type == &value_traits<vector<T>>::value_type);
return vector_value<T, const names> (v.data_);
}
template <typename T>
template <typename V>
- inline void value_traits<std::vector<T>>::
+ inline void value_traits<vector<T>>::
assign (value& v, V x)
{
if (v.null ())
{
if (v.type == nullptr)
- v.type = &value_traits<std::vector<T>>::value_type;
+ v.type = &value_traits<vector<T>>::value_type;
v.state_ = value::state_type::empty;
}
- v.state_ = (as (v).assign (std::move (x))).empty ()
+ v.state_ = (as (v).assign (move (x))).empty ()
? value::state_type::empty
: value::state_type::filled;
}
template <typename T>
template <typename V>
- inline void value_traits<std::vector<T>>::
+ inline void value_traits<vector<T>>::
append (value& v, V x)
{
if (v.null ())
- assign (v, std::move (x));
+ assign (v, move (x));
else
- v.state_ = (as (v).append (std::move (x))).empty ()
+ v.state_ = (as (v).append (move (x))).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -344,7 +344,7 @@ namespace build2
v.state_ = value::state_type::empty;
}
- v.state_ = (as (v).assign (std::move (x))).empty ()
+ v.state_ = (as (v).assign (move (x))).empty ()
? value::state_type::empty
: value::state_type::filled;
}
@@ -355,9 +355,9 @@ namespace build2
append (value& v, M x)
{
if (v.null ())
- assign (v, std::move (x));
+ assign (v, move (x));
else
- v.state_ = (as (v).append (std::move (x))).empty ()
+ v.state_ = (as (v).append (move (x))).empty ()
? value::state_type::empty
: value::state_type::filled;
}
diff --git a/build2/variable.txx b/build2/variable.txx
index 9870052..f2c55ff 100644
--- a/build2/variable.txx
+++ b/build2/variable.txx
@@ -2,8 +2,6 @@
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <iterator> // make_move_iterator()
-
#include <build2/diagnostics>
namespace build2
@@ -38,20 +36,20 @@ namespace build2
v = move (a);
else
v.insert (v.end (),
- std::make_move_iterator (a.begin ()),
- std::make_move_iterator (a.end ()));
+ make_move_iterator (a.begin ()),
+ make_move_iterator (a.end ()));
return !v.empty ();
}
template <typename T>
- const std::string value_traits<std::vector<T>>::type_name = std::string (
+ const string value_traits<vector<T>>::type_name = string (
value_traits<T>::value_type.name) + 's';
template <typename T>
- const value_type value_traits<std::vector<T>>::value_type
+ const value_type value_traits<vector<T>>::value_type
{
- value_traits<std::vector<T>>::type_name.c_str (),
+ value_traits<vector<T>>::type_name.c_str (),
&vector_assign<T>,
&vector_append<T>
};
@@ -67,7 +65,7 @@ namespace build2
{
d->emplace_back (p.first); // Const, can't move.
d->back ().pair = '=';
- d->emplace_back (std::move (p.second));
+ d->emplace_back (move (p.second));
}
return *this;
@@ -147,14 +145,14 @@ namespace build2
v = move (a);
else
v.insert (v.end (),
- std::make_move_iterator (a.begin ()),
- std::make_move_iterator (a.end ()));
+ make_move_iterator (a.begin ()),
+ make_move_iterator (a.end ()));
return !v.empty ();
}
template <typename K, typename V>
- const std::string value_traits<std::map<K, V>>::type_name = std::string (
+ const string value_traits<std::map<K, V>>::type_name = string (
value_traits<K>::value_type.name) + '_' +
value_traits<V>::value_type.name + "_map";