mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
fix: AppleClang 12 warnings (#2510)
* fix: AppleClang 12 new warning * Fix: AppleClang X.X.0 will not trigger this warning
This commit is contained in:
parent
4a288ab928
commit
d0ed035cc5
@ -2092,7 +2092,7 @@ private:
|
||||
}
|
||||
|
||||
void process(list &args_list, detail::args_proxy ap) {
|
||||
for (const auto &a : ap)
|
||||
for (auto a : ap)
|
||||
args_list.append(a);
|
||||
}
|
||||
|
||||
@ -2124,7 +2124,7 @@ private:
|
||||
void process(list &/*args_list*/, detail::kwargs_proxy kp) {
|
||||
if (!kp)
|
||||
return;
|
||||
for (const auto &k : reinterpret_borrow<dict>(kp)) {
|
||||
for (auto k : reinterpret_borrow<dict>(kp)) {
|
||||
if (m_kwargs.contains(k.first)) {
|
||||
#if defined(NDEBUG)
|
||||
multiple_values_error();
|
||||
|
@ -1494,7 +1494,7 @@ struct enum_base {
|
||||
handle type = type::handle_of(arg);
|
||||
object type_name = type.attr("__name__");
|
||||
dict entries = type.attr("__entries");
|
||||
for (const auto &kv : entries) {
|
||||
for (auto kv : entries) {
|
||||
object other = kv.second[int_(0)];
|
||||
if (other.equal(arg))
|
||||
return pybind11::str("{}.{}").format(type_name, kv.first);
|
||||
@ -1506,7 +1506,7 @@ struct enum_base {
|
||||
m_base.attr("name") = property(cpp_function(
|
||||
[](handle arg) -> str {
|
||||
dict entries = type::handle_of(arg).attr("__entries");
|
||||
for (const auto &kv : entries) {
|
||||
for (auto kv : entries) {
|
||||
if (handle(kv.second[int_(0)]).equal(arg))
|
||||
return pybind11::str(kv.first);
|
||||
}
|
||||
@ -1521,7 +1521,7 @@ struct enum_base {
|
||||
if (((PyTypeObject *) arg.ptr())->tp_doc)
|
||||
docstring += std::string(((PyTypeObject *) arg.ptr())->tp_doc) + "\n\n";
|
||||
docstring += "Members:";
|
||||
for (const auto &kv : entries) {
|
||||
for (auto kv : entries) {
|
||||
auto key = std::string(pybind11::str(kv.first));
|
||||
auto comment = kv.second[int_(1)];
|
||||
docstring += "\n\n " + key;
|
||||
@ -1535,7 +1535,7 @@ struct enum_base {
|
||||
m_base.attr("__members__") = static_property(cpp_function(
|
||||
[](handle arg) -> dict {
|
||||
dict entries = arg.attr("__entries"), m;
|
||||
for (const auto &kv : entries)
|
||||
for (auto kv : entries)
|
||||
m[kv.first] = kv.second[int_(0)];
|
||||
return m;
|
||||
}, name("__members__")), none(), none(), ""
|
||||
@ -1623,7 +1623,7 @@ struct enum_base {
|
||||
|
||||
PYBIND11_NOINLINE void export_values() {
|
||||
dict entries = m_base.attr("__entries");
|
||||
for (const auto &kv : entries)
|
||||
for (auto kv : entries)
|
||||
m_parent.attr(kv.first) = kv.second[int_(0)];
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ std::string abs(const Vector2&) {
|
||||
// Taken from: https://github.com/RobotLocomotion/drake/commit/aaf84b46
|
||||
// TODO(eric): This could be resolved using a function / functor (e.g. `py::self()`).
|
||||
#if defined(__APPLE__) && defined(__clang__)
|
||||
#if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
|
||||
#if (__clang_major__ >= 10)
|
||||
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
|
||||
#endif
|
||||
#elif defined(__clang__)
|
||||
|
@ -128,7 +128,7 @@ TEST_SUBMODULE(pytypes, m) {
|
||||
d["basic_attr"] = o.attr("basic_attr");
|
||||
|
||||
auto l = py::list();
|
||||
for (const auto &item : o.attr("begin_end")) {
|
||||
for (auto item : o.attr("begin_end")) {
|
||||
l.append(item);
|
||||
}
|
||||
d["begin_end"] = l;
|
||||
|
Loading…
Reference in New Issue
Block a user