Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just adds a disabled test, update dependencies #127

Merged
merged 2 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions include/ankerl/unordered_dense.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ inline void mum(uint64_t* a, uint64_t* b) {

ANKERL_UNORDERED_DENSE_EXPORT template <typename T, typename Enable = void>
struct hash {
auto operator()(T const& obj) const noexcept(noexcept(std::declval<std::hash<T>>().operator()(std::declval<T const&>())))
-> uint64_t {
auto operator()(T const& obj) const
noexcept(noexcept(std::declval<std::hash<T>>().operator()(std::declval<T const&>()))) -> uint64_t {
return std::hash<T>{}(obj);
}
};
Expand Down Expand Up @@ -1073,8 +1073,9 @@ class table : public std::conditional_t<is_map_v<T>, base_table_type_map<T>, bas
}

template <typename... Args>
auto do_place_element(dist_and_fingerprint_type dist_and_fingerprint, value_idx_type bucket_idx, Args&&... args)
-> std::pair<iterator, bool> {
auto do_place_element(dist_and_fingerprint_type dist_and_fingerprint,
value_idx_type bucket_idx,
Args&&... args) -> std::pair<iterator, bool> {

// emplace the new value. If that throws an exception, no harm done; index is still in a valid state
m_values.emplace_back(std::forward<Args>(args)...);
Expand Down
101 changes: 93 additions & 8 deletions subprojects/abseil-cpp.wrap
Original file line number Diff line number Diff line change
@@ -1,23 +1,108 @@
[wrap-file]
directory = abseil-cpp-20220623.0
source_url = https://github.com/abseil/abseil-cpp/archive/20220623.0.tar.gz
source_filename = abseil-cpp-20220623.0.tar.gz
source_hash = 4208129b49006089ba1d6710845a45e31c59b0ab6bff9e5788a87f55c5abd602
patch_filename = abseil-cpp_20220623.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20220623.0-2/get_patch
patch_hash = d19cb16610d9310658a815ebcd87a9e2966aafbd57964341c0d1a3a3778c03b6
wrapdb_version = 20220623.0-2
directory = abseil-cpp-20240722.0
source_url = https://github.com/abseil/abseil-cpp/releases/download/20240722.0/abseil-cpp-20240722.0.tar.gz
source_filename = abseil-cpp-20240722.0.tar.gz
source_hash = f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3
patch_filename = abseil-cpp_20240722.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20240722.0-1/get_patch
patch_hash = 692bbbc39cacaba4dc4b0c8b2fbbe32736c9cde6377acfa0d52088797af14ded
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20240722.0-1/abseil-cpp-20240722.0.tar.gz
wrapdb_version = 20240722.0-1

[provide]
absl_base = absl_base_dep
absl_container = absl_container_dep
absl_debugging = absl_debugging_dep
absl_log = absl_log_dep
absl_flags = absl_flags_dep
absl_hash = absl_hash_dep
absl_crc = absl_crc_dep
absl_numeric = absl_numeric_dep
absl_profiling = absl_profiling_dep
absl_random = absl_random_dep
absl_status = absl_status_dep
absl_strings = absl_strings_dep
absl_synchronization = absl_synchronization_dep
absl_time = absl_time_dep
absl_types = absl_types_dep
absl_algorithm_container = absl_base_dep
absl_any_invocable = absl_base_dep
absl_bad_any_cast_impl = absl_types_dep
absl_bad_optional_access = absl_types_dep
absl_bad_variant_access = absl_types_dep
absl_bind_front = absl_base_dep
absl_city = absl_hash_dep
absl_civil_time = absl_time_dep
absl_cleanup = absl_base_dep
absl_cord = absl_strings_dep
absl_cord_internal = absl_strings_dep
absl_cordz_functions = absl_strings_dep
absl_cordz_handle = absl_strings_dep
absl_cordz_info = absl_strings_dep
absl_cordz_sample_token = absl_strings_dep
absl_core_headers = absl_base_dep
absl_crc32c = absl_crc_dep
absl_debugging_internal = absl_debugging_dep
absl_demangle_internal = absl_debugging_dep
absl_die_if_null = absl_log_dep
absl_examine_stack = absl_debugging_dep
absl_exponential_biased = absl_profiling_dep
absl_failure_signal_handler = absl_debugging_dep
absl_flags_commandlineflag = absl_flags_dep
absl_flags_commandlineflag_internal = absl_flags_dep
absl_flags_config = absl_flags_dep
absl_flags_internal = absl_flags_dep
absl_flags_marshalling = absl_flags_dep
absl_flags_parse = absl_flags_dep
absl_flags_private_handle_accessor = absl_flags_dep
absl_flags_program_name = absl_flags_dep
absl_flags_reflection = absl_flags_dep
absl_flags_usage = absl_flags_dep
absl_flags_usage_internal = absl_flags_dep
absl_flat_hash_map = absl_container_dep
absl_flat_hash_set = absl_container_dep
absl_function_ref = absl_base_dep
absl_graphcycles_internal = absl_synchronization_dep
absl_hashtablez_sampler = absl_container_dep
absl_inlined_vector = absl_container_dep
absl_int128 = absl_numeric_dep
absl_leak_check = absl_debugging_dep
absl_log_initialize = absl_log_dep
absl_log_internal_check_op = absl_log_dep
absl_log_internal_message = absl_log_dep
absl_log_severity = absl_base_dep
absl_low_level_hash = absl_hash_dep
absl_memory = absl_base_dep
absl_optional = absl_types_dep
absl_periodic_sampler = absl_profiling_dep
absl_random_bit_gen_ref = absl_random_dep
absl_random_distributions = absl_random_dep
absl_random_internal_distribution_test_util = absl_random_dep
absl_random_internal_platform = absl_random_dep
absl_random_internal_pool_urbg = absl_random_dep
absl_random_internal_randen = absl_random_dep
absl_random_internal_randen_hwaes = absl_random_dep
absl_random_internal_randen_hwaes_impl = absl_random_dep
absl_random_internal_randen_slow = absl_random_dep
absl_random_internal_seed_material = absl_random_dep
absl_random_random = absl_random_dep
absl_random_seed_gen_exception = absl_random_dep
absl_random_seed_sequences = absl_random_dep
absl_raw_hash_set = absl_container_dep
absl_raw_logging_internal = absl_base_dep
absl_scoped_set_env = absl_base_dep
absl_span = absl_types_dep
absl_spinlock_wait = absl_base_dep
absl_stacktrace = absl_debugging_dep
absl_statusor = absl_status_dep
absl_str_format = absl_strings_dep
absl_str_format_internal = absl_strings_dep
absl_strerror = absl_base_dep
absl_string_view = absl_strings_dep
absl_strings_internal = absl_strings_dep
absl_symbolize = absl_debugging_dep
absl_throw_delegate = absl_base_dep
absl_time_zone = absl_time_dep
absl_type_traits = absl_base_dep
absl_utility = absl_base_dep
absl_variant = absl_types_dep
11 changes: 6 additions & 5 deletions subprojects/doctest.wrap
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[wrap-file]
directory = doctest-2.4.9
source_url = https://github.com/doctest/doctest/archive/refs/tags/v2.4.9.tar.gz
source_filename = doctest-2.4.9.tar.gz
source_hash = 19b2df757f2f3703a5e63cee553d85596875f06d91a3333acd80a969ef210856
wrapdb_version = 2.4.9-1
directory = doctest-2.4.11
source_url = https://github.com/doctest/doctest/archive/refs/tags/v2.4.11.tar.gz
source_filename = doctest-2.4.11.tar.gz
source_hash = 632ed2c05a7f53fa961381497bf8069093f0d6628c5f26286161fbd32a560186
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/doctest_2.4.11-1/doctest-2.4.11.tar.gz
wrapdb_version = 2.4.11-1

[provide]
dependency_names = doctest
17 changes: 9 additions & 8 deletions subprojects/fmt.wrap
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[wrap-file]
directory = fmt-9.1.0
source_url = https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz
source_filename = fmt-9.1.0.tar.gz
source_hash = 5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2
patch_filename = fmt_9.1.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/fmt_9.1.0-1/get_patch
patch_hash = 4557b9ba87b3eb63694ed9b21d1a2117d4a97ca56b91085b10288e9a5294adf8
wrapdb_version = 9.1.0-1
directory = fmt-11.0.2
source_url = https://github.com/fmtlib/fmt/archive/11.0.2.tar.gz
source_filename = fmt-11.0.2.tar.gz
source_hash = 6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f
patch_filename = fmt_11.0.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.0.2-1/get_patch
patch_hash = 90c9e3b8e8f29713d40ca949f6f93ad115d78d7fb921064112bc6179e6427c5e
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.0.2-1/fmt-11.0.2.tar.gz
wrapdb_version = 11.0.2-1

[provide]
fmt = fmt_dep
4 changes: 4 additions & 0 deletions test/app/counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ auto counter::obj::get() const -> size_t const& {
return m_data;
}

auto counter::obj::counts() -> counter& {
return *m_counts;
}

auto counter::obj::get() -> size_t& {
if (nullptr != m_counts) {
++m_counts->m_data.m_get;
Expand Down
2 changes: 2 additions & 0 deletions test/app/counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class counter {
[[nodiscard]] auto get() const -> size_t const&;
auto get() -> size_t&;

[[nodiscard]] auto counts() -> counter&;

void swap(obj& other);
[[nodiscard]] auto get_for_hash() const -> size_t;

Expand Down
1 change: 1 addition & 0 deletions test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ test_sources = [
'unit/not_moveable.cpp',
'unit/pmr_move_with_allocators.cpp',
'unit/pmr.cpp',
'unit/reentrant.cpp',
'unit/rehash.cpp',
'unit/replace.cpp',
'unit/reserve_and_assign.cpp',
Expand Down
1 change: 0 additions & 1 deletion test/unit/diamond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <app/doctest.h>

#include <cstddef> // for size_t
#include <vector> // for vector

// struct that provides both hash and equals operator
struct hash_with_equal {
Expand Down
44 changes: 44 additions & 0 deletions test/unit/reentrant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <ankerl/unordered_dense.h>

#include <app/counter.h>
#include <app/doctest.h>

namespace {

class EraseOnDestruct;

using map_t = ankerl::unordered_dense::map<counter::obj, std::unique_ptr<EraseOnDestruct>>;

class EraseOnDestruct {
map_t* m_map;
counter::obj m_counter;

public:
EraseOnDestruct(map_t& map, size_t i, counter& counts)
: m_map(&map)
, m_counter(i, counts) {}

~EraseOnDestruct() {
(void)m_map;
m_map->erase(counter::obj{m_counter.get() + 1, m_counter.counts()});
}
};

} // namespace

TEST_CASE("reentrant_destruct") {
auto counts = counter{};
INFO(counts);

auto map = map_t();

/*
This doesn't work, it is not something that can be supported with using std::vector.
I'll leave the code here so it's not lost though.

for (size_t i = 0; i < 100; ++i) {
map.try_emplace(counter::obj{i, counts}, std::make_unique<EraseOnDestruct>(map, i, counts));
}
map.erase(counter::obj{0, counts});
*/
}
Loading