From 4611c375420e8532340905e676abe94022d6f902 Mon Sep 17 00:00:00 2001 From: Martin Leitner-Ankerl Date: Thu, 14 Dec 2023 20:00:44 +0100 Subject: [PATCH] f --- include/ankerl/unordered_dense.h | 2 ++ test/bench/game_of_life.cpp | 10 +++++++--- test/bench/show_allocations.cpp | 6 ++++-- test/meson.build | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/ankerl/unordered_dense.h b/include/ankerl/unordered_dense.h index 0aed5616..12577f1d 100644 --- a/include/ankerl/unordered_dense.h +++ b/include/ankerl/unordered_dense.h @@ -893,7 +893,9 @@ class table : public std::conditional_t, base_table_type_map, bas // assumes m_values has data, m_buckets=m_buckets_end=nullptr, m_shifts is INITIAL_SHIFTS void copy_buckets(table const& other) { + // assumes m_values has already the correct data copied over. if (empty()) { + // when empty, at least allocate an initial buckets and clear them. allocate_buckets_from_shift(); clear_buckets(); } else { diff --git a/test/bench/game_of_life.cpp b/test/bench/game_of_life.cpp index a005a50f..1e29354c 100644 --- a/test/bench/game_of_life.cpp +++ b/test/bench/game_of_life.cpp @@ -9,7 +9,9 @@ #include #if __has_include("boost/unordered/unordered_flat_map.hpp") -# pragma clang diagnostic ignored "-Wold-style-cast" +# if defined(__clang__) +# pragma clang diagnostic ignored "-Wold-style-cast" +# endif # include "boost/unordered/unordered_flat_map.hpp" # define HAS_BOOST_UNORDERED_FLAT_MAP() 1 // NOLINT(cppcoreguidelines-macro-usage) #else @@ -17,8 +19,10 @@ #endif #if 0 && __has_include("absl/container/flat_hash_map.h") -# pragma clang diagnostic ignored "-Wdeprecated-builtins" -# pragma clang diagnostic ignored "-Wsign-conversion" +# if defined(__clang__) +# pragma clang diagnostic ignored "-Wdeprecated-builtins" +# pragma clang diagnostic ignored "-Wsign-conversion" +# endif # include # define HAS_ABSL() 1 // NOLINT(cppcoreguidelines-macro-usage) #else diff --git a/test/bench/show_allocations.cpp b/test/bench/show_allocations.cpp index 55365a06..2158e192 100644 --- a/test/bench/show_allocations.cpp +++ b/test/bench/show_allocations.cpp @@ -6,8 +6,10 @@ #include #if __has_include("boost/unordered/unordered_flat_map.hpp") -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wold-style-cast" +# if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wold-style-cast" +# endif # include "boost/unordered/unordered_flat_map.hpp" # define HAS_BOOST_UNORDERED_FLAT_MAP() 1 // NOLINT(cppcoreguidelines-macro-usage) #else diff --git a/test/meson.build b/test/meson.build index fedb6a6f..76981efc 100644 --- a/test/meson.build +++ b/test/meson.build @@ -88,6 +88,7 @@ foreach arg : [ '-Wno-stringop-overflow', # g++ error in fmtlib '-Warith-conversion', '-Wshadow=global', + '-Wno-array-bounds', # gcc 13 gives incorrect warning # gcc / clang '-Wconversion',