diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index ea781cdbc..1822a8025 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -217,7 +217,7 @@ void construct(value_and_holder &v_h, std::shared_ptr> &&shd_ptr, boo if (Class::has_alias && need_alias && !is_alias(ptr)) throw type_error("pybind11::init(): construction failed: returned std::shared_ptr pointee " "is not an alias instance"); - auto smhldr = type_caster>::template smart_holder_from_shared_ptr(shd_ptr); + auto smhldr = type_caster>::template smart_holder_from_shared_ptr(shd_ptr); v_h.value_ptr() = ptr; v_h.type->init_instance(v_h.inst, &smhldr); } @@ -230,7 +230,7 @@ void construct(value_and_holder &v_h, bool /*need_alias*/) { auto *ptr = shd_ptr.get(); no_nullptr(ptr); - auto smhldr = type_caster>::template smart_holder_from_shared_ptr(shd_ptr); + auto smhldr = type_caster>::template smart_holder_from_shared_ptr(shd_ptr); v_h.value_ptr() = ptr; v_h.type->init_instance(v_h.inst, &smhldr); } diff --git a/include/pybind11/detail/smart_holder_poc.h b/include/pybind11/detail/smart_holder_poc.h index 953852e27..ee507a14f 100644 --- a/include/pybind11/detail/smart_holder_poc.h +++ b/include/pybind11/detail/smart_holder_poc.h @@ -124,7 +124,7 @@ struct smart_holder { bool pointee_depends_on_holder_owner : 1; // SMART_HOLDER_WIP: See PR #2839. // Design choice: smart_holder is movable but not copyable. - smart_holder(smart_holder &&) = default; + smart_holder(smart_holder &&) = default; smart_holder(const smart_holder &) = delete; smart_holder &operator=(smart_holder &&) = delete; smart_holder &operator=(const smart_holder &) = delete; @@ -219,7 +219,7 @@ struct smart_holder { smart_holder hld; hld.vptr.reset(raw_ptr, [](void *) {}); hld.vptr_is_using_noop_deleter = true; - hld.is_populated = true; + hld.is_populated = true; return hld; } @@ -254,7 +254,7 @@ struct smart_holder { else hld.vptr.reset(raw_ptr, std::move(gd)); hld.vptr_is_using_builtin_delete = true; - hld.is_populated = true; + hld.is_populated = true; return hld; } @@ -298,7 +298,7 @@ struct smart_holder { static smart_holder from_unique_ptr(std::unique_ptr &&unq_ptr, bool void_cast_raw_ptr = false) { smart_holder hld; - hld.rtti_uqp_del = &typeid(D); + hld.rtti_uqp_del = &typeid(D); hld.vptr_is_using_builtin_delete = is_std_default_delete(*hld.rtti_uqp_del); guarded_delete gd{nullptr, false}; if (hld.vptr_is_using_builtin_delete) @@ -327,9 +327,9 @@ struct smart_holder { template static smart_holder from_shared_ptr(std::shared_ptr shd_ptr) { smart_holder hld; - hld.vptr = std::static_pointer_cast(shd_ptr); + hld.vptr = std::static_pointer_cast(shd_ptr); hld.vptr_is_external_shared_ptr = true; - hld.is_populated = true; + hld.is_populated = true; return hld; } diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 797c152ce..acc9efe76 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -308,7 +308,7 @@ struct smart_holder_type_caster_class_hooks : smart_holder_type_caster_base_tag v_h.set_instance_registered(); } auto uninitialized_location = std::addressof(v_h.holder()); - auto value_ptr_w_t = v_h.value_ptr(); + auto value_ptr_w_t = v_h.value_ptr(); bool pointee_depends_on_holder_owner = dynamic_raw_ptr_cast_if_possible(value_ptr_w_t) != nullptr; if (holder_void_ptr) { @@ -627,21 +627,21 @@ struct smart_holder_type_caster : smart_holder_type_caster_load, if (handle existing_inst = find_registered_python_instance(src, tinfo)) return existing_inst; - auto inst = reinterpret_steal(make_new_instance(tinfo->type)); - auto wrapper = reinterpret_cast(inst.ptr()); - wrapper->owned = false; + auto inst = reinterpret_steal(make_new_instance(tinfo->type)); + auto wrapper = reinterpret_cast(inst.ptr()); + wrapper->owned = false; void *&valueptr = values_and_holders(wrapper).begin()->value_ptr(); switch (policy) { case return_value_policy::automatic: case return_value_policy::take_ownership: - valueptr = src; + valueptr = src; wrapper->owned = true; break; case return_value_policy::automatic_reference: case return_value_policy::reference: - valueptr = src; + valueptr = src; wrapper->owned = false; break; @@ -683,7 +683,7 @@ struct smart_holder_type_caster : smart_holder_type_caster_load, break; case return_value_policy::reference_internal: - valueptr = src; + valueptr = src; wrapper->owned = false; keep_alive_impl(inst, parent); break; @@ -724,22 +724,22 @@ struct smart_holder_type_caster> : smart_holder_type_caster_l return none().release(); auto src_raw_ptr = src.get(); - auto st = type_caster_base::src_and_type(src_raw_ptr); + auto st = type_caster_base::src_and_type(src_raw_ptr); if (st.second == nullptr) return handle(); // no type info: error will be set already - void *src_raw_void_ptr = static_cast(src_raw_ptr); + void *src_raw_void_ptr = static_cast(src_raw_ptr); const detail::type_info *tinfo = st.second; if (handle existing_inst = find_registered_python_instance(src_raw_void_ptr, tinfo)) // SMART_HOLDER_WIP: MISSING: Enforcement of consistency with existing smart_holder. // SMART_HOLDER_WIP: MISSING: keep_alive. return existing_inst; - auto inst = reinterpret_steal(make_new_instance(tinfo->type)); - auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); + auto inst = reinterpret_steal(make_new_instance(tinfo->type)); + auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); inst_raw_ptr->owned = true; - void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); - valueptr = src_raw_void_ptr; + void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); + valueptr = src_raw_void_ptr; auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(src); tinfo->init_instance(inst_raw_ptr, static_cast(&smhldr)); @@ -791,11 +791,11 @@ struct smart_holder_type_caster> : smart_holder_type_caste return none().release(); auto src_raw_ptr = src.get(); - auto st = type_caster_base::src_and_type(src_raw_ptr); + auto st = type_caster_base::src_and_type(src_raw_ptr); if (st.second == nullptr) return handle(); // no type info: error will be set already - void *src_raw_void_ptr = static_cast(src_raw_ptr); + void *src_raw_void_ptr = static_cast(src_raw_ptr); const detail::type_info *tinfo = st.second; if (handle existing_inst = find_registered_python_instance(src_raw_void_ptr, tinfo)) { auto *self_life_support @@ -819,11 +819,11 @@ struct smart_holder_type_caster> : smart_holder_type_caste throw cast_error("Invalid unique_ptr: another instance owns this pointer already."); } - auto inst = reinterpret_steal(make_new_instance(tinfo->type)); - auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); + auto inst = reinterpret_steal(make_new_instance(tinfo->type)); + auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); inst_raw_ptr->owned = true; - void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); - valueptr = src_raw_void_ptr; + void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); + valueptr = src_raw_void_ptr; auto smhldr = pybindit::memory::smart_holder::from_unique_ptr(std::move(src), /*void_cast_raw_ptr*/ false); diff --git a/include/pybind11/trampoline_self_life_support.h b/include/pybind11/trampoline_self_life_support.h index cdb1fb3ed..c37e2226f 100644 --- a/include/pybind11/trampoline_self_life_support.h +++ b/include/pybind11/trampoline_self_life_support.h @@ -41,7 +41,7 @@ struct trampoline_self_life_support { void *value_void_ptr = v_h.value_ptr(); if (value_void_ptr != nullptr) { PyGILState_STATE threadstate = PyGILState_Ensure(); - v_h.value_ptr() = nullptr; + v_h.value_ptr() = nullptr; v_h.holder().release_disowned(); detail::deregister_instance(v_h.inst, value_void_ptr, v_h.type); Py_DECREF((PyObject *) v_h.inst); // Must be after deregister. diff --git a/tests/pure_cpp/smart_holder_poc_test.cpp b/tests/pure_cpp/smart_holder_poc_test.cpp index 5a56c2821..d795f41d3 100644 --- a/tests/pure_cpp/smart_holder_poc_test.cpp +++ b/tests/pure_cpp/smart_holder_poc_test.cpp @@ -11,7 +11,7 @@ struct movable_int { int valu; movable_int(int v) : valu{v} {} movable_int(movable_int &&other) noexcept { - valu = other.valu; + valu = other.valu; other.valu = 91; } }; @@ -36,13 +36,13 @@ private: TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_unowned", "[S]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE(*hld.as_raw_ptr_unowned() == 19); } TEST_CASE("from_raw_ptr_unowned+as_lvalue_ref", "[S]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE(hld.as_lvalue_ref() == 19); } @@ -58,28 +58,28 @@ TEST_CASE("from_raw_ptr_unowned+as_rvalue_ref", "[S]") { TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_release_ownership", "[E]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE_THROWS_WITH(hld.as_raw_ptr_release_ownership(), "Cannot disown non-owning holder (as_raw_ptr_release_ownership)."); } TEST_CASE("from_raw_ptr_unowned+as_unique_ptr", "[E]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE_THROWS_WITH(hld.as_unique_ptr(), "Cannot disown non-owning holder (as_unique_ptr)."); } TEST_CASE("from_raw_ptr_unowned+as_unique_ptr_with_deleter", "[E]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE_THROWS_WITH((hld.as_unique_ptr>()), "Missing unique_ptr deleter (as_unique_ptr)."); } TEST_CASE("from_raw_ptr_unowned+as_shared_ptr", "[S]") { static int value = 19; - auto hld = smart_holder::from_raw_ptr_unowned(&value); + auto hld = smart_holder::from_raw_ptr_unowned(&value); REQUIRE(*hld.as_shared_ptr() == 19); } @@ -90,28 +90,28 @@ TEST_CASE("from_raw_ptr_take_ownership+as_lvalue_ref", "[S]") { } TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership1", "[S]") { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); auto new_owner = std::unique_ptr(hld.as_raw_ptr_release_ownership()); REQUIRE(!hld.has_pointee()); REQUIRE(*new_owner == 19); } TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership2", "[E]") { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); auto shd_ptr = hld.as_shared_ptr(); REQUIRE_THROWS_WITH(hld.as_raw_ptr_release_ownership(), "Cannot disown use_count != 1 (as_raw_ptr_release_ownership)."); } TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr1", "[S]") { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); std::unique_ptr new_owner = hld.as_unique_ptr(); REQUIRE(!hld.has_pointee()); REQUIRE(*new_owner == 19); } TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr2", "[E]") { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); auto shd_ptr = hld.as_shared_ptr(); REQUIRE_THROWS_WITH(hld.as_unique_ptr(), "Cannot disown use_count != 1 (as_unique_ptr)."); } @@ -123,7 +123,7 @@ TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr_with_deleter", "[E]") { } TEST_CASE("from_raw_ptr_take_ownership+as_shared_ptr", "[S]") { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); std::shared_ptr new_owner = hld.as_shared_ptr(); REQUIRE(hld.has_pointee()); REQUIRE(*new_owner == 19); @@ -155,7 +155,7 @@ TEST_CASE("from_raw_ptr_take_ownership+disown+release_disowned", "[S]") { TEST_CASE("from_raw_ptr_take_ownership+disown+ensure_is_not_disowned", "[E]") { const char *context = "test_case"; - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); hld.ensure_is_not_disowned(context); // Does not throw. std::unique_ptr new_owner(hld.as_raw_ptr_unowned()); hld.disown(); @@ -327,7 +327,7 @@ TEST_CASE("indestructible_int-from_raw_ptr_unowned+as_raw_ptr_unowned", "[S]") { // Using placement new instead of plain new, to not trigger leak sanitizer errors. static std::aligned_storage::type memory_block[1]; auto *value = new (memory_block) zombie(19); - auto hld = smart_holder::from_raw_ptr_unowned(value); + auto hld = smart_holder::from_raw_ptr_unowned(value); REQUIRE(hld.as_raw_ptr_unowned()->valu == 19); } @@ -341,7 +341,7 @@ TEST_CASE("from_raw_ptr_take_ownership+as_shared_ptr-outliving_smart_holder", "[ // Exercises guarded_builtin_delete flag_ptr validity past destruction of smart_holder. std::shared_ptr longer_living; { - auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); + auto hld = smart_holder::from_raw_ptr_take_ownership(new int(19)); longer_living = hld.as_shared_ptr(); } REQUIRE(*longer_living == 19); @@ -352,7 +352,7 @@ TEST_CASE("from_unique_ptr_with_deleter+as_shared_ptr-outliving_smart_holder", " std::shared_ptr longer_living; { std::unique_ptr> orig_owner(new int(19)); - auto hld = smart_holder::from_unique_ptr(std::move(orig_owner)); + auto hld = smart_holder::from_unique_ptr(std::move(orig_owner)); longer_living = hld.as_shared_ptr(); } REQUIRE(*longer_living == 19); diff --git a/tests/test_class_sh_disowning_mi.cpp b/tests/test_class_sh_disowning_mi.cpp index 1e7b1166b..1ff6ef7bb 100644 --- a/tests/test_class_sh_disowning_mi.cpp +++ b/tests/test_class_sh_disowning_mi.cpp @@ -9,8 +9,8 @@ namespace class_sh_disowning_mi { // Diamond inheritance (copied from test_multiple_inheritance.cpp). struct B { - int val_b = 10; - B() = default; + int val_b = 10; + B() = default; B(const B &) = default; virtual ~B() = default; }; diff --git a/tests/test_class_sh_factory_constructors.cpp b/tests/test_class_sh_factory_constructors.cpp index fb8a8caee..7e8025f0e 100644 --- a/tests/test_class_sh_factory_constructors.cpp +++ b/tests/test_class_sh_factory_constructors.cpp @@ -57,12 +57,12 @@ std::unique_ptr rtrn_udcp() { return std::unique_ptr // Using int as a trick to easily generate a series of types. struct Abase { - int val = 0; + int val = 0; virtual ~Abase() = default; Abase(int val_) : val{val_} {} int Get() const { return val * 10 + 3; } virtual int Add(int other_val) const = 0; // Some compilers complain about implicitly defined versions of some of the following: - Abase(const Abase &) = default; + Abase(const Abase &) = default; Abase(Abase &&) noexcept = default; Abase &operator=(const Abase &) = default; Abase &operator=(Abase &&) noexcept = default; diff --git a/tests/test_class_sh_trampoline_self_life_support.cpp b/tests/test_class_sh_trampoline_self_life_support.cpp index ffcea710f..3339c7307 100644 --- a/tests/test_class_sh_trampoline_self_life_support.cpp +++ b/tests/test_class_sh_trampoline_self_life_support.cpp @@ -68,12 +68,12 @@ TEST_SUBMODULE(class_sh_trampoline_self_life_support, m) { case 2: { // operator= lvalue std::unique_ptr lv(new Big5Trampoline); *lv = *obj_trampoline; - o2 = py::cast(std::move(lv)); + o2 = py::cast(std::move(lv)); } break; case 3: { // operator= rvalue std::unique_ptr rv(new Big5Trampoline); *rv = std::move(*obj_trampoline); - o2 = py::cast(std::move(rv)); + o2 = py::cast(std::move(rv)); } break; default: break; diff --git a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp index 866667a69..33b67c291 100644 --- a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp +++ b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp @@ -21,9 +21,9 @@ struct SpBase { return (bool) py::detail::get_object_handle(this, tinfo); } - SpBase() = default; + SpBase() = default; SpBase(const SpBase &) = delete; - virtual ~SpBase() = default; + virtual ~SpBase() = default; }; std::shared_ptr pass_through_shd_ptr(const std::shared_ptr &obj) { return obj; } diff --git a/tests/test_class_sh_trampoline_unique_ptr.cpp b/tests/test_class_sh_trampoline_unique_ptr.cpp index 8a54da8f8..141a6e8b5 100644 --- a/tests/test_class_sh_trampoline_unique_ptr.cpp +++ b/tests/test_class_sh_trampoline_unique_ptr.cpp @@ -18,7 +18,7 @@ public: std::uint64_t getVal() const { return val_; } virtual std::unique_ptr clone() const = 0; - virtual int foo() const = 0; + virtual int foo() const = 0; protected: Class() = default; diff --git a/tests/test_class_sh_unique_ptr_member.cpp b/tests/test_class_sh_unique_ptr_member.cpp index ff33346ca..89e5885ea 100644 --- a/tests/test_class_sh_unique_ptr_member.cpp +++ b/tests/test_class_sh_unique_ptr_member.cpp @@ -14,7 +14,7 @@ public: int get_int() const { return 213; } pointee(const pointee &) = delete; - pointee(pointee &&) = delete; + pointee(pointee &&) = delete; pointee &operator=(const pointee &) = delete; pointee &operator=(pointee &&) = delete; }; diff --git a/tests/test_class_sh_virtual_py_cpp_mix.cpp b/tests/test_class_sh_virtual_py_cpp_mix.cpp index 696368ad4..e8c17f107 100644 --- a/tests/test_class_sh_virtual_py_cpp_mix.cpp +++ b/tests/test_class_sh_virtual_py_cpp_mix.cpp @@ -13,7 +13,7 @@ public: virtual int get() const { return 101; } // Some compilers complain about implicitly defined versions of some of the following: - Base() = default; + Base() = default; Base(const Base &) = default; }; diff --git a/ubench/number_bucket.h b/ubench/number_bucket.h index 75523cb60..fe04a1e56 100644 --- a/ubench/number_bucket.h +++ b/ubench/number_bucket.h @@ -14,8 +14,8 @@ struct number_bucket { explicit number_bucket(std::size_t data_size = 0) : data(data_size, 1.0) {} double sum() const { - std::size_t n = 0; - double s = 0; + std::size_t n = 0; + double s = 0; const double *a = &*data.begin(); const double *e = &*data.end(); while (a != e) { @@ -34,8 +34,8 @@ struct number_bucket { std::cerr << "Incompatible data sizes (add)." << std::endl; std::terminate(); } - std::size_t n = 0; - double *a = &*data.begin(); + std::size_t n = 0; + double *a = &*data.begin(); const double *e = &*data.end(); const double *b = &*other.data.begin(); while (a != e) { @@ -47,7 +47,7 @@ struct number_bucket { private: number_bucket(const number_bucket &) = delete; - number_bucket(number_bucket &&) = delete; + number_bucket(number_bucket &&) = delete; number_bucket &operator=(const number_bucket &) = delete; number_bucket &operator=(number_bucket &&) = delete; };