aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-02 08:17:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-02 08:17:00 +0200
commite8945fbb15e472afca16fe1c3f36997742a2d64a (patch)
tree83d3d4bd7606b5ce62686afd5efb874e246fa443 /build
parent39623df224608e77b5a62dabd35b09783198bc87 (diff)
Common types cleanup (strings, cstrings)
Diffstat (limited to 'build')
-rw-r--r--build/cli/rule.cxx5
-rw-r--r--build/config/utility3
-rw-r--r--build/cxx/rule.cxx14
-rw-r--r--build/diagnostics4
-rw-r--r--build/types9
5 files changed, 19 insertions, 16 deletions
diff --git a/build/cli/rule.cxx b/build/cli/rule.cxx
index 889e6a2..9abe665 100644
--- a/build/cli/rule.cxx
+++ b/build/cli/rule.cxx
@@ -6,6 +6,7 @@
#include <butl/process>
+#include <build/types>
#include <build/scope>
#include <build/target>
#include <build/context>
@@ -183,7 +184,7 @@ namespace build
}
static void
- append_extension (vector<const char*>& args,
+ append_extension (cstrings& args,
path_target& t,
const char* option,
const char* default_extension)
@@ -224,7 +225,7 @@ namespace build
scope& rs (t.root_scope ());
const string& cli (rs["config.cli"].as<const string&> ());
- vector<const char*> args {cli.c_str ()};
+ cstrings args {cli.c_str ()};
// See if we need to pass any --?xx-suffix options.
//
diff --git a/build/config/utility b/build/config/utility
index c2209e4..8ab6afe 100644
--- a/build/config/utility
+++ b/build/config/utility
@@ -5,7 +5,6 @@
#ifndef BUILD_CONFIG_UTILITY
#define BUILD_CONFIG_UTILITY
-#include <vector>
#include <string>
#include <utility> // pair
@@ -47,7 +46,7 @@ namespace build
//
template <typename T>
void
- append_options (std::vector<const char*>& args, T& s, const char* var)
+ append_options (cstrings& args, T& s, const char* var)
{
if (auto val = s[var])
{
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx
index 7547201..e0e5c0f 100644
--- a/build/cxx/rule.cxx
+++ b/build/cxx/rule.cxx
@@ -6,7 +6,6 @@
#include <map>
#include <string>
-#include <vector>
#include <cstddef> // size_t
#include <cstdlib> // exit
#include <utility> // move()
@@ -17,6 +16,7 @@
#include <butl/optional>
#include <butl/path-map>
+#include <build/types>
#include <build/scope>
#include <build/variable>
#include <build/algorithm>
@@ -40,7 +40,7 @@ namespace build
using config::append_options;
static void
- append_std (vector<const char*>& args, target& t, string& opt)
+ append_std (cstrings& args, target& t, string& opt)
{
if (auto val = t["cxx.std"])
{
@@ -66,7 +66,7 @@ namespace build
// recursively, prerequisite libraries first.
//
static void
- append_lib_options (vector<const char*>& args, target& l, const char* var)
+ append_lib_options (cstrings& args, target& l, const char* var)
{
for (target* t: l.prerequisite_targets)
{
@@ -381,7 +381,7 @@ namespace build
scope& rs (t.root_scope ());
const string& cxx (rs["config.cxx"].as<const string&> ());
- vector<const char*> args {cxx.c_str ()};
+ cstrings args {cxx.c_str ()};
// Add cxx.export.poptions from prerequisite libraries. Note
// that here we don't need to see group members (see apply()).
@@ -725,7 +725,7 @@ namespace build
scope& rs (t.root_scope ());
const string& cxx (rs["config.cxx"].as<const string&> ());
- vector<const char*> args {cxx.c_str ()};
+ cstrings args {cxx.c_str ()};
// Add cxx.export.poptions from prerequisite libraries. Note that
// here we don't need to see group members (see apply()).
@@ -1175,7 +1175,7 @@ namespace build
path relt (relative (t.path ()));
scope& rs (t.root_scope ());
- vector<const char*> args;
+ cstrings args;
string storage1;
if (lt == type::a)
@@ -1206,7 +1206,7 @@ namespace build
// Reserve enough space so that we don't reallocate. Reallocating
// means pointers to elements may no longer be valid.
//
- vector<path> relo;
+ paths relo;
relo.reserve (t.prerequisite_targets.size ());
for (target* pt: t.prerequisite_targets)
diff --git a/build/diagnostics b/build/diagnostics
index 6c528f2..3f05688 100644
--- a/build/diagnostics
+++ b/build/diagnostics
@@ -5,7 +5,6 @@
#ifndef BUILD_DIAGNOSTICS
#define BUILD_DIAGNOSTICS
-#include <vector>
#include <cstdint>
#include <utility>
#include <cassert>
@@ -16,6 +15,7 @@
#include <butl/path>
+#include <build/types>
#include <build/path-io>
namespace build
@@ -72,7 +72,7 @@ namespace build
print_process (const char* const* args);
inline void
- print_process (const std::vector<const char*>& args)
+ print_process (const cstrings& args)
{
print_process (args.data ());
}
diff --git a/build/types b/build/types
index 5f6b3de..0a71252 100644
--- a/build/types
+++ b/build/types
@@ -6,6 +6,7 @@
#define BUILD_TYPES
#include <vector>
+#include <string>
#include <butl/path>
#include <butl/timestamp>
@@ -16,6 +17,8 @@ namespace build
{
// Commonly-used types.
//
+ using strings = std::vector<std::string>;
+ using cstrings = std::vector<const char*>;
// <butl/path>
//
@@ -24,6 +27,9 @@ namespace build
using butl::basic_path;
using butl::invalid_path;
+ using paths = std::vector<path>;
+ using dir_paths = std::vector<dir_path>;
+
// <butl/timestamp>
//
using butl::system_clock;
@@ -32,9 +38,6 @@ namespace build
using butl::timestamp_unknown;
using butl::timestamp_nonexistent;
using butl::operator<<;
-
- typedef std::vector<path> paths;
- typedef std::vector<dir_path> dir_paths;
}
#endif // BUILD_TYPES