Skip to content

Commit

Permalink
Restore smart_holder_poc.h as-is on smart_holder branch (i.e. undo `P…
Browse files Browse the repository at this point in the history
…YBIND11_SMART_HOLDER_PADDING`, which was meant for stress-testing only).
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jul 23, 2024
1 parent 58f9e18 commit c02d2cd
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions include/pybind11/detail/smart_holder_poc.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,15 @@ inline bool is_std_default_delete(const std::type_info &rtti_deleter) {
|| rtti_deleter == typeid(std::default_delete<T const>);
}

// Meant to help detecting invalid `reinterpret_cast`s or similar.
#ifdef PYBIND11_SMART_HOLDER_PADDING_ON
# define PYBIND11_SMART_HOLDER_PADDING(N) int PADDING_##N##_[11]
#else
# define PYBIND11_SMART_HOLDER_PADDING(N)
#endif

struct smart_holder {
PYBIND11_SMART_HOLDER_PADDING(1);
const std::type_info *rtti_uqp_del = nullptr;
PYBIND11_SMART_HOLDER_PADDING(2);
std::shared_ptr<void> vptr;
PYBIND11_SMART_HOLDER_PADDING(3);
bool vptr_is_using_noop_deleter : 1;
PYBIND11_SMART_HOLDER_PADDING(4);
bool vptr_is_using_builtin_delete : 1;
PYBIND11_SMART_HOLDER_PADDING(5);
bool vptr_is_external_shared_ptr : 1;
PYBIND11_SMART_HOLDER_PADDING(6);
bool is_populated : 1;
PYBIND11_SMART_HOLDER_PADDING(7);
bool is_disowned : 1;
PYBIND11_SMART_HOLDER_PADDING(8);
bool pointee_depends_on_holder_owner : 1; // SMART_HOLDER_WIP: See PR #2839.
PYBIND11_SMART_HOLDER_PADDING(9);

// Design choice: smart_holder is movable but not copyable.
smart_holder(smart_holder &&) = default;
Expand Down

0 comments on commit c02d2cd

Please sign in to comment.