aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-01-30 11:25:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-01-30 11:25:42 +0200
commit67d799852492743a93a464002395ccb624514fb8 (patch)
treed46193a6c13f9cd64f9ff545b8b1f5fc441bab00 /libbuild2
parentf6319b258bb478e19d4a17852a8406e6b1119b87 (diff)
Add std::{map, multimap} to types.hxx
Seeing that std::map is becoming a common Buildfile variable type.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/bin/init.cxx2
-rw-r--r--libbuild2/cc/guess.cxx1
-rw-r--r--libbuild2/cc/link-rule.cxx2
-rw-r--r--libbuild2/cc/module.cxx1
-rw-r--r--libbuild2/cc/types.hxx3
-rw-r--r--libbuild2/config/module.hxx4
-rw-r--r--libbuild2/config/operation.cxx2
-rw-r--r--libbuild2/function.hxx3
-rw-r--r--libbuild2/module.hxx4
-rw-r--r--libbuild2/rule-map.hxx4
-rw-r--r--libbuild2/scope.hxx6
-rw-r--r--libbuild2/target-key.hxx1
-rw-r--r--libbuild2/target-type.hxx6
-rw-r--r--libbuild2/test/script/parser.hxx1
-rw-r--r--libbuild2/types.hxx3
-rw-r--r--libbuild2/utility.hxx3
-rw-r--r--libbuild2/variable.cxx10
-rw-r--r--libbuild2/variable.hxx21
-rw-r--r--libbuild2/variable.ixx6
-rw-r--r--libbuild2/variable.txx14
-rw-r--r--libbuild2/version/module.hxx4
21 files changed, 35 insertions, 66 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index fb82d21..51066cb 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -3,8 +3,6 @@
#include <libbuild2/bin/init.hxx>
-#include <map>
-
#include <libbuild2/scope.hxx>
#include <libbuild2/function.hxx>
#include <libbuild2/variable.hxx>
diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx
index d068c20..1e0c77a 100644
--- a/libbuild2/cc/guess.cxx
+++ b/libbuild2/cc/guess.cxx
@@ -65,7 +65,6 @@
# include <libbuild2/filesystem.hxx>
#endif
-#include <map>
#include <cstring> // strlen(), strchr(), strstr()
#include <libbuild2/diagnostics.hxx>
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 9b75e8d..5b12876 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -3,7 +3,6 @@
#include <libbuild2/cc/link-rule.hxx>
-#include <map>
#include <cstdlib> // exit()
#include <cstring> // strlen()
@@ -24,7 +23,6 @@
#include <libbuild2/cc/target.hxx> // c, pc*
#include <libbuild2/cc/utility.hxx>
-using std::map;
using std::exit;
using namespace butl;
diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx
index 1709c23..971f175 100644
--- a/libbuild2/cc/module.cxx
+++ b/libbuild2/cc/module.cxx
@@ -3,7 +3,6 @@
#include <libbuild2/cc/module.hxx>
-#include <map>
#include <iomanip> // left, setw()
#include <libbuild2/scope.hxx>
diff --git a/libbuild2/cc/types.hxx b/libbuild2/cc/types.hxx
index 70a6340..1297b7b 100644
--- a/libbuild2/cc/types.hxx
+++ b/libbuild2/cc/types.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_CC_TYPES_HXX
#define LIBBUILD2_CC_TYPES_HXX
-#include <map>
#include <unordered_map>
#include <libbuild2/types.hxx>
@@ -149,7 +148,7 @@ namespace build2
// The key is either an absolute and normalized header path or a reference
// to an importable_headers group (e.g., <vector>, std).
//
- using translatable_headers = std::map<string, optional<bool>>;
+ using translatable_headers = map<string, optional<bool>>;
// Special translatable header groups.
//
diff --git a/libbuild2/config/module.hxx b/libbuild2/config/module.hxx
index 857a30c..3afe721 100644
--- a/libbuild2/config/module.hxx
+++ b/libbuild2/config/module.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_CONFIG_MODULE_HXX
#define LIBBUILD2_CONFIG_MODULE_HXX
-#include <map>
-
#include <libbutl/prefix-map.mxx>
#include <libbuild2/types.hxx>
@@ -55,7 +53,7 @@ namespace build2
// Priority order with INT32_MIN being the highest. Modules with the
// same priority are saved in the order inserted.
//
- std::multimap<std::int32_t, const_iterator> order;
+ multimap<std::int32_t, const_iterator> order;
pair<iterator, bool>
insert (string name, int prio = 0)
diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx
index b9856be..f9d83da 100644
--- a/libbuild2/config/operation.cxx
+++ b/libbuild2/config/operation.cxx
@@ -82,8 +82,6 @@ namespace build2
}
}
- using project_set = set<const scope*>; // Use pointers to get comparison.
-
// Return (first) whether an unused/inherited variable should be saved
// according to the config.config.persist value and (second) whether the
// user should be warned about it.
diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx
index 8fdf8f4..6654257 100644
--- a/libbuild2/function.hxx
+++ b/libbuild2/function.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_FUNCTION_HXX
#define LIBBUILD2_FUNCTION_HXX
-#include <map>
#include <utility> // index_sequence
#include <type_traits> // aligned_storage
@@ -196,7 +195,7 @@ namespace build2
class LIBBUILD2_SYMEXPORT function_map
{
public:
- using map_type = std::map<string, function_overloads>;
+ using map_type = map<string, function_overloads>;
using iterator = map_type::iterator;
using const_iterator = map_type::const_iterator;
diff --git a/libbuild2/module.hxx b/libbuild2/module.hxx
index 770e694..8223bae 100644
--- a/libbuild2/module.hxx
+++ b/libbuild2/module.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_MODULE_HXX
#define LIBBUILD2_MODULE_HXX
-#include <map>
-
#include <libbuild2/types.hxx>
#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
@@ -275,7 +273,7 @@ namespace build2
// A NULL entry for the main module indicates that a module library was not
// found.
//
- using loaded_module_map = std::map<string, const module_functions*>;
+ using loaded_module_map = map<string, const module_functions*>;
// The loaded_modules map is locked per top-level (as opposed to nested)
// context (see context.hxx for details).
diff --git a/libbuild2/rule-map.hxx b/libbuild2/rule-map.hxx
index df59548..8014d02 100644
--- a/libbuild2/rule-map.hxx
+++ b/libbuild2/rule-map.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_RULE_MAP_HXX
#define LIBBUILD2_RULE_MAP_HXX
-#include <map>
-
#include <libbutl/prefix-map.mxx>
#include <libbuild2/types.hxx>
@@ -19,7 +17,7 @@ namespace build2
using hint_rule_map =
butl::prefix_map<string, reference_wrapper<const rule>, '.'>;
- using target_type_rule_map = std::map<const target_type*, hint_rule_map>;
+ using target_type_rule_map = map<const target_type*, hint_rule_map>;
// This is an "indexed map" with operation_id being the index. Entry
// with id 0 is a wildcard.
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index d441267..bd82853 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_SCOPE_HXX
#define LIBBUILD2_SCOPE_HXX
-#include <map>
#include <unordered_set>
#include <libbuild2/types.hxx>
@@ -27,7 +26,7 @@ namespace build2
{
class dir;
- using subprojects = std::map<project_name, dir_path>;
+ using subprojects = map<project_name, dir_path>;
LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const subprojects&); // Print as name@dir sequence.
@@ -416,8 +415,7 @@ namespace build2
function<callback> post;
};
- using operation_callback_map = std::multimap<action_id,
- operation_callback>;
+ using operation_callback_map = multimap<action_id, operation_callback>;
operation_callback_map operation_callbacks;
diff --git a/libbuild2/target-key.hxx b/libbuild2/target-key.hxx
index 62bcc25..2cc58f9 100644
--- a/libbuild2/target-key.hxx
+++ b/libbuild2/target-key.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_TARGET_KEY_HXX
#define LIBBUILD2_TARGET_KEY_HXX
-#include <map>
#include <cstring> // strcmp()
#include <libbuild2/types.hxx>
diff --git a/libbuild2/target-type.hxx b/libbuild2/target-type.hxx
index 88171f5..913432e 100644
--- a/libbuild2/target-type.hxx
+++ b/libbuild2/target-type.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_TARGET_TYPE_HXX
#define LIBBUILD2_TARGET_TYPE_HXX
-#include <map>
-
#include <libbuild2/types.hxx>
#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
@@ -203,8 +201,8 @@ namespace build2
bool d_;
};
- std::map<string, target_type_ref> type_map_;
- std::map<string, reference_wrapper<const target_type>> file_map_;
+ map<string, target_type_ref> type_map_;
+ map<string, reference_wrapper<const target_type>> file_map_;
};
}
diff --git a/libbuild2/test/script/parser.hxx b/libbuild2/test/script/parser.hxx
index f8c3f21..f118ad3 100644
--- a/libbuild2/test/script/parser.hxx
+++ b/libbuild2/test/script/parser.hxx
@@ -4,6 +4,7 @@
#ifndef LIBBUILD2_TEST_SCRIPT_PARSER_HXX
#define LIBBUILD2_TEST_SCRIPT_PARSER_HXX
+#include <set>
#include <unordered_map>
#include <libbuild2/types.hxx>
diff --git a/libbuild2/types.hxx b/libbuild2/types.hxx
index 60101b3..6877f92 100644
--- a/libbuild2/types.hxx
+++ b/libbuild2/types.hxx
@@ -13,6 +13,7 @@
# include <libbuild2/config.hxx>
#endif
+#include <map>
#include <array>
#include <tuple>
#include <vector>
@@ -92,6 +93,8 @@ namespace build2
using std::shared_ptr;
using std::weak_ptr;
+ using std::map;
+ using std::multimap;
using std::array;
using std::vector;
using butl::vector_view; // <libbutl/vector-view.mxx>
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index 3ffc7b2..4cfdf15 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_UTILITY_HXX
#define LIBBUILD2_UTILITY_HXX
-#include <map>
#include <tuple> // make_tuple()
#include <memory> // make_shared()
#include <string> // to_string()
@@ -566,7 +565,7 @@ namespace build2
}
private:
- std::map<string, T> cache_;
+ map<string, T> cache_;
mutable mutex mutex_;
};
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index 6f45e90..8cd6404 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -1841,17 +1841,17 @@ namespace build2
value_traits<vector<pair<string, optional<bool>>>>;
template struct LIBBUILD2_DEFEXPORT
- value_traits<std::map<string, string>>;
+ value_traits<map<string, string>>;
template struct LIBBUILD2_DEFEXPORT
- value_traits<std::map<string, optional<string>>>;
+ value_traits<map<string, optional<string>>>;
template struct LIBBUILD2_DEFEXPORT
- value_traits<std::map<optional<string>, string>>;
+ value_traits<map<optional<string>, string>>;
template struct LIBBUILD2_DEFEXPORT
- value_traits<std::map<string, optional<bool>>>;
+ value_traits<map<string, optional<bool>>>;
template struct LIBBUILD2_DEFEXPORT
- value_traits<std::map<project_name, dir_path>>;
+ value_traits<map<project_name, dir_path>>;
}
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index a04e0a9..2d85af3 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -4,7 +4,6 @@
#ifndef LIBBUILD2_VARIABLE_HXX
#define LIBBUILD2_VARIABLE_HXX
-#include <map>
#include <set>
#include <type_traits> // aligned_storage
#include <unordered_map>
@@ -1126,9 +1125,9 @@ namespace build2
struct map_value_type;
template <typename K, typename V>
- struct value_traits<std::map<K, V>>
+ struct value_traits<map<K, V>>
{
- template <typename K1, typename V1> using map = std::map<K1, V1>;
+ template <typename K1, typename V1> using map = map<K1, V1>;
static_assert (sizeof (map<K, V>) <= value::size_, "insufficient space");
@@ -1167,19 +1166,19 @@ namespace build2
value_traits<vector<pair<string, optional<bool>>>>;
extern template struct LIBBUILD2_DECEXPORT
- value_traits<std::map<string, string>>;
+ value_traits<map<string, string>>;
extern template struct LIBBUILD2_DECEXPORT
- value_traits<std::map<string, optional<string>>>;
+ value_traits<map<string, optional<string>>>;
extern template struct LIBBUILD2_DECEXPORT
- value_traits<std::map<optional<string>, string>>;
+ value_traits<map<optional<string>, string>>;
extern template struct LIBBUILD2_DECEXPORT
- value_traits<std::map<string, optional<bool>>>;
+ value_traits<map<string, optional<bool>>>;
extern template struct LIBBUILD2_DECEXPORT
- value_traits<std::map<project_name, dir_path>>; // var_subprojects
+ value_traits<map<project_name, dir_path>>; // var_subprojects
// Project-wide (as opposed to global) variable overrides (see context ctor
// for details).
@@ -1712,7 +1711,7 @@ namespace build2
stem_version (sver) {}
};
- using map_type = std::map<K, entry_type>;
+ using map_type = map<K, entry_type>;
map_type m_;
};
@@ -1734,7 +1733,7 @@ namespace build2
class variable_pattern_map
{
public:
- using map_type = std::map<string, variable_map>;
+ using map_type = map<string, variable_map>;
using const_iterator = map_type::const_iterator;
using const_reverse_iterator = map_type::const_reverse_iterator;
@@ -1762,7 +1761,7 @@ namespace build2
class LIBBUILD2_SYMEXPORT variable_type_map
{
public:
- using map_type = std::map<reference_wrapper<const target_type>,
+ using map_type = map<reference_wrapper<const target_type>,
variable_pattern_map>;
using const_iterator = map_type::const_iterator;
diff --git a/libbuild2/variable.ixx b/libbuild2/variable.ixx
index fd78842..a84c012 100644
--- a/libbuild2/variable.ixx
+++ b/libbuild2/variable.ixx
@@ -853,7 +853,7 @@ namespace build2
// map<K, V> value
//
template <typename K, typename V>
- inline void value_traits<std::map<K, V>>::
+ inline void value_traits<map<K, V>>::
assign (value& v, map<K, V>&& x)
{
if (v)
@@ -863,7 +863,7 @@ namespace build2
}
template <typename K, typename V>
- inline void value_traits<std::map<K, V>>::
+ inline void value_traits<map<K, V>>::
append (value& v, map<K, V>&& x)
{
if (v)
@@ -884,7 +884,7 @@ namespace build2
}
template <typename K, typename V>
- inline void value_traits<std::map<K, V>>::
+ inline void value_traits<map<K, V>>::
prepend (value& v, map<K, V>&& x)
{
if (v)
diff --git a/libbuild2/variable.txx b/libbuild2/variable.txx
index e1808fc..3e4a9f3 100644
--- a/libbuild2/variable.txx
+++ b/libbuild2/variable.txx
@@ -813,8 +813,6 @@ namespace build2
void
map_append (value& v, names&& ns, const variable* var)
{
- using std::map;
-
map<K, V>& p (v
? v.as<map<K, V>> ()
: *new (&v.data_) map<K, V> ());
@@ -840,8 +838,6 @@ namespace build2
void
map_prepend (value& v, names&& ns, const variable* var)
{
- using std::map;
-
map<K, V>& p (v
? v.as<map<K, V>> ()
: *new (&v.data_) map<K, V> ());
@@ -869,8 +865,6 @@ namespace build2
void
map_assign (value& v, names&& ns, const variable* var)
{
- using std::map;
-
if (v)
v.as<map<K, V>> ().clear ();
@@ -881,8 +875,6 @@ namespace build2
static names_view
map_reverse (const value& v, names& s)
{
- using std::map;
-
auto& vm (v.as<map<K, V>> ());
s.reserve (2 * vm.size ());
@@ -896,8 +888,6 @@ namespace build2
static int
map_compare (const value& l, const value& r)
{
- using std::map;
-
auto& lm (l.as<map<K, V>> ());
auto& rm (r.as<map<K, V>> ());
@@ -975,11 +965,11 @@ namespace build2
};
template <typename K, typename V>
- const std::map<K, V> value_traits<std::map<K, V>>::empty_instance;
+ const map<K, V> value_traits<map<K, V>>::empty_instance;
template <typename K, typename V>
const map_value_type<K, V>
- value_traits<std::map<K, V>>::value_type = build2::value_type // VC14 wants =
+ value_traits<map<K, V>>::value_type = build2::value_type // VC14 wants =
{
nullptr, // Patched above.
sizeof (map<K, V>),
diff --git a/libbuild2/version/module.hxx b/libbuild2/version/module.hxx
index 26bd48a..e80870e 100644
--- a/libbuild2/version/module.hxx
+++ b/libbuild2/version/module.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_VERSION_MODULE_HXX
#define LIBBUILD2_VERSION_MODULE_HXX
-#include <map>
-
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
@@ -26,7 +24,7 @@ namespace build2
string constraint;
};
- using dependencies = std::map<string, dependency>;
+ using dependencies = map<string, dependency>;
struct module: build2::module
{