Nikos Nikoleris has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/34775 )
Change subject: ext: Fix range loops in pybind that can't use references
......................................................................
ext: Fix range loops in pybind that can't use references
Use rvalue references in range loops where lvalue references are
require uncessary copies and cause clang warnings.
Change-Id: Iaf8e85e6ed54bbb786754ac755187adc778d8c59
Signed-off-by: Nikos Nikoleris <nikos.nikole...@arm.com>
---
M ext/pybind11/include/pybind11/cast.h
M ext/pybind11/include/pybind11/pybind11.h
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ext/pybind11/include/pybind11/cast.h
b/ext/pybind11/include/pybind11/cast.h
index 605acb3..33c6c6d 100644
--- a/ext/pybind11/include/pybind11/cast.h
+++ b/ext/pybind11/include/pybind11/cast.h
@@ -2008,7 +2008,7 @@
}
void process(list &args_list, detail::args_proxy ap) {
- for (const auto &a : ap)
+ for (const auto &&a : ap)
args_list.append(a);
}
@@ -2040,7 +2040,7 @@
void process(list &/*args_list*/, detail::kwargs_proxy kp) {
if (!kp)
return;
- for (const auto &k : reinterpret_borrow<dict>(kp)) {
+ for (const auto &&k : reinterpret_borrow<dict>(kp)) {
if (m_kwargs.contains(k.first)) {
#if defined(NDEBUG)
multiple_values_error();
diff --git a/ext/pybind11/include/pybind11/pybind11.h
b/ext/pybind11/include/pybind11/pybind11.h
index a9ee31a..147eae2 100644
--- a/ext/pybind11/include/pybind11/pybind11.h
+++ b/ext/pybind11/include/pybind11/pybind11.h
@@ -1409,7 +1409,7 @@
handle type = arg.get_type();
object type_name = type.attr("__name__");
dict entries = type.attr("__entries");
- for (const auto &kv : entries) {
+ for (const auto &&kv : entries) {
object other = kv.second[int_(0)];
if (other.equal(arg))
return pybind11::str("{}.{}").format(type_name,
kv.first);
@@ -1421,7 +1421,7 @@
m_base.attr("name") = property(cpp_function(
[](handle arg) -> str {
dict entries = arg.get_type().attr("__entries");
- for (const auto &kv : entries) {
+ for (const auto &&kv : entries) {
if (handle(kv.second[int_(0)]).equal(arg))
return pybind11::str(kv.first);
}
@@ -1436,7 +1436,7 @@
if (((PyTypeObject *) arg.ptr())->tp_doc)
docstring += std::string(((PyTypeObject *)
arg.ptr())->tp_doc) + "\n\n";
docstring += "Members:";
- for (const auto &kv : entries) {
+ for (const auto &&kv : entries) {
auto key = std::string(pybind11::str(kv.first));
auto comment = kv.second[int_(1)];
docstring += "\n\n " + key;
@@ -1450,7 +1450,7 @@
m_base.attr("__members__") = static_property(cpp_function(
[](handle arg) -> dict {
dict entries = arg.attr("__entries"), m;
- for (const auto &kv : entries)
+ for (const auto &&kv : entries)
m[kv.first] = kv.second[int_(0)];
return m;
}), none(), none(), ""
@@ -1538,7 +1538,7 @@
PYBIND11_NOINLINE void export_values() {
dict entries = m_base.attr("__entries");
- for (const auto &kv : entries)
+ for (const auto &&kv : entries)
m_parent.attr(kv.first) = kv.second[int_(0)];
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/34775
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Iaf8e85e6ed54bbb786754ac755187adc778d8c59
Gerrit-Change-Number: 34775
Gerrit-PatchSet: 1
Gerrit-Owner: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s