aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-12 05:51:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-12 05:51:26 +0200
commit5773833af8d8644bb59e664fe068c93b825974e3 (patch)
tree727b5ed1d39b1ef5fb021395dcc3330dedb7bd0d /libbuild2
parentc027dfcdfccd1e5f581649ebf176b091081fa21d (diff)
Hack around GCC 13 -Wdangling-reference false positives
See GCC bugs 107532, 110213.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx5
-rw-r--r--libbuild2/algorithm.cxx2
-rw-r--r--libbuild2/algorithm.hxx2
-rw-r--r--libbuild2/variable.hxx12
-rw-r--r--libbuild2/variable.ixx12
5 files changed, 17 insertions, 16 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index a67b07b..61a9e21 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -718,10 +718,11 @@ namespace build2
//
for (dir_path& d: p.second)
{
+ dir_path o; string n; // For GCC 13 -Wdangling-reference.
const fsdir& dt (search<fsdir> (t,
move (d),
- dir_path (),
- string (), nullptr, nullptr));
+ move (o),
+ move (n), nullptr, nullptr));
match_sync (a, dt);
pts.push_back (prerequisite_target (&dt, true /* adhoc */));
}
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 3c0da3b..4db3d72 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -122,7 +122,7 @@ namespace build2
}
const target&
- search (const target& t, name n, const scope& s, const target_type* tt)
+ search (const target& t, name&& n, const scope& s, const target_type* tt)
{
assert (t.ctx.phase == run_phase::match);
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 216ec4b..8bdf737 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -164,7 +164,7 @@ namespace build2
// argument.
//
LIBBUILD2_SYMEXPORT const target&
- search (const target&, name, const scope&, const target_type* = nullptr);
+ search (const target&, name&&, const scope&, const target_type* = nullptr);
// Note: returns NULL for unknown target types. Note that unlike the above
// version, these ones can be called during the load and execute phases.
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 3220a62..2d7f8ba 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -465,37 +465,37 @@ namespace build2
template <typename T> T& cast (value&);
template <typename T> T&& cast (value&&);
template <typename T> const T& cast (const value&);
- template <typename T> const T& cast (const lookup&);
+ template <typename T> const T& cast (lookup);
// As above but returns NULL if the value is NULL (or not defined, in
// case of lookup).
//
template <typename T> T* cast_null (value&);
template <typename T> const T* cast_null (const value&);
- template <typename T> const T* cast_null (const lookup&);
+ template <typename T> const T* cast_null (lookup);
// As above but returns empty value if the value is NULL (or not defined, in
// case of lookup).
//
template <typename T> const T& cast_empty (const value&);
- template <typename T> const T& cast_empty (const lookup&);
+ template <typename T> const T& cast_empty (lookup);
// As above but returns the specified default if the value is NULL (or not
// defined, in case of lookup). Note that the return is by value, not by
// reference.
//
template <typename T> T cast_default (const value&, const T&);
- template <typename T> T cast_default (const lookup&, const T&);
+ template <typename T> T cast_default (lookup, const T&);
// As above but returns false/true if the value is NULL (or not defined,
// in case of lookup). Note that the template argument is only for
// documentation and should be bool (or semantically compatible).
//
template <typename T> T cast_false (const value&);
- template <typename T> T cast_false (const lookup&);
+ template <typename T> T cast_false (lookup);
template <typename T> T cast_true (const value&);
- template <typename T> T cast_true (const lookup&);
+ template <typename T> T cast_true (lookup);
// Assign value type to the value. The variable is optional and is only used
// for diagnostics.
diff --git a/libbuild2/variable.ixx b/libbuild2/variable.ixx
index c7b1f35..51c35fd 100644
--- a/libbuild2/variable.ixx
+++ b/libbuild2/variable.ixx
@@ -224,7 +224,7 @@ namespace build2
template <typename T>
inline const T&
- cast (const lookup& l)
+ cast (lookup l)
{
return cast<T> (*l);
}
@@ -245,7 +245,7 @@ namespace build2
template <typename T>
inline const T*
- cast_null (const lookup& l)
+ cast_null (lookup l)
{
return l ? &cast<T> (*l) : nullptr;
}
@@ -259,7 +259,7 @@ namespace build2
template <typename T>
inline const T&
- cast_empty (const lookup& l)
+ cast_empty (lookup l)
{
return l ? cast<T> (l) : value_traits<T>::empty_instance;
}
@@ -273,7 +273,7 @@ namespace build2
template <typename T>
inline T
- cast_default (const lookup& l, const T& d)
+ cast_default (lookup l, const T& d)
{
return l ? cast<T> (l) : d;
}
@@ -287,7 +287,7 @@ namespace build2
template <typename T>
inline T
- cast_false (const lookup& l)
+ cast_false (lookup l)
{
return l && cast<T> (l);
}
@@ -301,7 +301,7 @@ namespace build2
template <typename T>
inline T
- cast_true (const lookup& l)
+ cast_true (lookup l)
{
return !l || cast<T> (l);
}