From 29ca66f49488af6c4d109a38b9d2309b3e8e1831 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 9 Jun 2025 12:43:07 -0700 Subject: [PATCH] Fix clang-tidy bugprone-multi-level-implicit-pointer-conversion warnings in headers --- src/List.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/List.h b/src/List.h index 07f8a2b42f..47a7bc9f5e 100644 --- a/src/List.h +++ b/src/List.h @@ -38,7 +38,7 @@ public: constexpr static int DEFAULT_LIST_SIZE = 10; constexpr static int LIST_GROWTH_FACTOR = 2; - ~List() { free(entries); } + ~List() { free(static_cast(entries)); } explicit List(int size = 0) { num_entries = 0; @@ -78,7 +78,8 @@ public: List(const T* arr, int n) { num_entries = max_entries = n; entries = (T*)util::safe_malloc(max_entries * sizeof(T)); - memcpy(entries, arr, n * sizeof(T)); // NOLINT(bugprone-bitwise-pointer-cast) + // NOLINTNEXTLINE(bugprone-bitwise-pointer-cast,bugprone-multi-level-implicit-pointer-conversion) + memcpy(entries, arr, n * sizeof(T)); } List(std::initializer_list il) : List(il.begin(), il.size()) {} @@ -87,7 +88,7 @@ public: if ( this == &b ) return *this; - free(entries); + free(static_cast(entries)); max_entries = b.max_entries; num_entries = b.num_entries; @@ -107,7 +108,7 @@ public: if ( this == &b ) return *this; - free(entries); + free(static_cast(entries)); entries = b.entries; num_entries = b.num_entries; max_entries = b.max_entries; @@ -122,7 +123,7 @@ public: void clear() // remove all entries { - free(entries); + free(static_cast(entries)); entries = nullptr; num_entries = max_entries = 0; }