Ralf W. Grosse-Kunstleve
e2108546e1
Adding unit tests: 2 x test_std_make_shared_factory
...
Completes unit test coverage for the changed code in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
1b752f56c1
Adding unit test: test_multiple_registered_instances_for_same_pointee
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
64716cc14c
Adding a few comments after review by @laramiel.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4a08160a1f
Revert "Updating Catch version to latest, in hopes of resolving the GHA download issue affecting all MSVC builds."
...
This reverts commit f4e1112dc434d0505cecad6259113f0621ecba70.
It didn't help.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
db6244864f
Updating Catch version to latest, in hopes of resolving the GHA download issue affecting all MSVC builds.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ab3c5134ad
Cleaning out debug code.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ef89a43452
Removing experimental code from here. Will be moved to https://github.com/rwgk/rwgk_tbx .
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
146a925e4e
Resolving TODOs for from_unique_ptr
void_cast_raw_ptr
. Adding test to exercise the path through cast
. The path through init.h is missing a test that would fail if the flag is incorrect. The plan is to systematically cover all situations (there are many that are not exercised for shared_from_this).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a0e19bdc46
Use casting to void *
to evade to shared_from_this mechanism only if pointee_depends_on_holder_owner
, but currently only for from_raw_ptr_take_ownership
.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ccd16a1a14
Adding test_pure_cpp_sft_raw_ptr (with 3 TODO: Fix), test_pure_cpp_sft_shd_ptr (works as desired).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4a15ed742c
Adding // NOLINT for clang-tidy.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
10abe15052
Automatic clang-tidy fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
48eb78ae77
Simpler and safe implementation based on new requirement: C++ (outside of the Python object) needs to hold a shared_ptr before shared_from_this is called. This is more similar to the existing implementation on current smart_holder HEAD, but still uses a weak_ptr to always return the same shared_ptr as long as C++ does not let it expire.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
3dd89f14df
smart_holder_poc.h: type-erase raw_ptr before passing to shared_ptr::reset, to not trigger populating the shared_from_this weak_ptr. This way the only way the weak_ptr is populated is through loaded_as_shared_ptr. Breaks all but one test in test_class_sh_trampoline_shared_from_this.py, now marked skip WIP to test everything else with the GitHub CI.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
b1d9f0d28f
Applying clang-tidy suggested fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
adfd3e1700
Partial cleanup of tests. WIP. The cleanup uncovered a major problem.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bfd4c4893e
Leveraging new noop_deleter_acting_as_weak_ptr_owner
to retrieve released vptr
.
...
The placeholder `vptr` is never exposed anymore, therefore the externally visible `use_count`s are more intuitive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
0e4b38e34d
Minor clang-tidy fix.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4b872febcc
Adding test_pass_released_shared_ptr_as_unique_ptr
, exercising new guard in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e04196e82b
Attempts to side-step various platform-specific issues.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
6214137c8d
Resolving gcc warning-as-error (many versions, old and new).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
553054b26b
Adding tests involving stashing shared_ptr
s. WIP.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4218213f29
nodiscard fix.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
223283295f
Two minor platform-specific fixes. Using static_cast instead of reinterpret_cast.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bf8d6a2900
First fully successful attempt to make shared_from_this
and trampolines play nicely.
...
Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
5bb38c10b3
MSVC 2015 compatibility.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
45ec61f419
Adding shared_ptr_reset_and_rescue_pointee_model_proof_of_concept.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
b633bb5b84
Inserting #ifdef
to preempt Windows fatal exception.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e0b770d549
Explictly discarding [[nodiscard]] to avoid MSVC CI failures.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4f00ffdc69
Copying in shared_from_this_custom_deleters.cpp from github.com/rwgk, with adjustments.
...
Base version: e5318faa6a/shared_from_this_custom_deleters.cpp
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
28ed5ecce8
Revert "Experiment: commenting out test_class_sh_shared_from_this."
...
This reverts commit febf9ce949c0bc87a8bf7ab3ddae4deb28636c9d.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
6989f174ac
Experiment: commenting out test_class_sh_shared_from_this.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
05bd93543b
Fully emulating type_caster_base-related behavior: trying shared_from_this also for unowned pointees.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e1de4e88b8
Adding test_class_sh_shared_from_this.cpp to tests/CMakeLists.txt.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
775873d0b6
Adding from_raw_pointer_take_ownership_or_shared_from_this().
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
2a265860a7
enable_shared_from_this_from_raw_ptr_take_ownership_guard: better static_assert that also triggers for derived classes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
24c223ad8e
static_assert in from_raw_ptr_take_ownership, to be tested.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
7a74bfede7
Restoring init_holder overload for std::enable_shared_from_this and original tests/test_smart_ptr.py.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e5b38a4459
Breaking up test_shared_ptr_from_this_and_references into smaller subtests. Skipping the only test that generates an ASAN heap-use-after-free.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
94523e8a02
Experiments: 1. disabling enable_shared_from_this, 2. using smart_holder in test_class_sh_shared_from_this.cpp
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
252b6aefb8
Isolating shared_from_this tests from test_smart_ptr (minimal changes).
2021-06-30 07:04:31 -07:00
Jakob Lykke Andersen
b9241c0330
SM, remove type annotations in test
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
f39efb850b
SH, attribute and property tests
2021-06-29 05:57:32 -07:00
Ralf W. Grosse-Kunstleve
fa5ffc3d02
Automatic clang-format.
2021-06-29 05:57:32 -07:00
Ralf W. Grosse-Kunstleve
a428f5755d
Automatic clang-tidy fixes.
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
f06f0927b3
SH, history tracking
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
0337ed944d
SH, fix use of PYBIND11_TYPE_CASTER_BASE_HOLDER
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
ee53a45ffd
SH, fix typo
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
b735093fde
SH, shared_ptr copy/move, rename to 'history'
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
ef6907c1ae
SH, shared_ptr copy/move, make MSVC happy
2021-06-29 05:57:32 -07:00