aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-07-23 10:49:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-07-23 10:49:37 +0200
commit7292c24ba3e4c0016e40466239437fe5819c47de (patch)
treefa066913ee9d5a8aea7d26bfd02ffa691dd4e1a4 /libbuild2/variable.hxx
parent4c628d939413bb722a6819d8e3798d79051619ce (diff)
Reserve variable names/components that start with underscore to build2 core
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r--libbuild2/variable.hxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 53e393d..c0f0fd9 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -1222,25 +1222,25 @@ namespace build2
const variable&
insert (string name)
{
- return insert (move (name), nullptr, nullptr, nullptr);
+ return insert (move (name), nullptr, nullptr, nullptr).first;
}
const variable&
insert (string name, variable_visibility v)
{
- return insert (move (name), nullptr, &v, nullptr);
+ return insert (move (name), nullptr, &v, nullptr).first;
}
const variable&
insert (string name, bool overridable)
{
- return insert (move (name), nullptr, nullptr, &overridable);
+ return insert (move (name), nullptr, nullptr, &overridable).first;
}
const variable&
insert (string name, bool overridable, variable_visibility v)
{
- return insert (move (name), nullptr, &v, &overridable);
+ return insert (move (name), nullptr, &v, &overridable). first;
}
template <typename T>
@@ -1248,14 +1248,15 @@ namespace build2
insert (string name)
{
return insert (
- move (name), &value_traits<T>::value_type, nullptr, nullptr);
+ move (name), &value_traits<T>::value_type, nullptr, nullptr).first;
}
template <typename T>
const variable&
insert (string name, variable_visibility v)
{
- return insert (move (name), &value_traits<T>::value_type, &v, nullptr);
+ return insert (
+ move (name), &value_traits<T>::value_type, &v, nullptr).first;
}
template <typename T>
@@ -1263,7 +1264,7 @@ namespace build2
insert (string name, bool overridable)
{
return insert (
- move (name), &value_traits<T>::value_type, nullptr, &overridable);
+ move (name), &value_traits<T>::value_type, nullptr, &overridable).first;
}
template <typename T>
@@ -1271,7 +1272,7 @@ namespace build2
insert (string name, bool overridable, variable_visibility v)
{
return insert (
- move (name), &value_traits<T>::value_type, &v, &overridable);
+ move (name), &value_traits<T>::value_type, &v, &overridable).first;
}
const variable&
@@ -1280,7 +1281,7 @@ namespace build2
bool overridable,
variable_visibility v)
{
- return insert (move (name), type, &v, &overridable);
+ return insert (move (name), type, &v, &overridable).first;
}
// Alias an existing variable with a new name.
@@ -1371,10 +1372,12 @@ namespace build2
friend class scope;
private:
+ friend class parser;
+
// Note that in insert() NULL overridable is interpreted as false unless
// overridden by a pattern while in update() NULL overridable is ignored.
//
- LIBBUILD2_SYMEXPORT variable&
+ LIBBUILD2_SYMEXPORT pair<variable&, bool>
insert (string name,
const value_type*,
const variable_visibility*,