From 2b885aebfe332811a9382c4b6953080fcee00031 Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Tue, 2 Jul 2024 18:52:00 +0900 Subject: [PATCH 01/10] fix(pointcloud_preprocessor): fix preprocessorErrorDirective Signed-off-by: Ryuta Kambe --- .../src/downsample_filter/robin_hood.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 02fa183e5d017..0c5de9897288f 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -123,15 +123,6 @@ static Counts & counts() // mark unused members with this macro #define ROBIN_HOOD_UNUSED(identifier) -// bitness -#if SIZE_MAX == UINT32_MAX -#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 32 -#elif SIZE_MAX == UINT64_MAX -#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 64 -#else -#error Unsupported bitness -#endif - // endianess #ifdef _MSC_VER #define ROBIN_HOOD_PRIVATE_DEFINITION_LITTLE_ENDIAN() 1 From 54a8643ab4b2fa9b6f32545aa7b5126c09a42dc3 Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Tue, 2 Jul 2024 19:05:19 +0900 Subject: [PATCH 02/10] fix postfixOperator Signed-off-by: Ryuta Kambe --- .../pointcloud_preprocessor/src/downsample_filter/robin_hood.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 0c5de9897288f..b7e94d00f63dd 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -1373,7 +1373,7 @@ class Table Iter & operator++() noexcept { mInfo++; - mKeyVals++; + ++mKeyVals; fastForward(); return *this; } From 8ab18f3f2bb61893522f4a2c4f367291e190448a Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Tue, 2 Jul 2024 19:35:33 +0900 Subject: [PATCH 03/10] remove unnecessary count() and contains() Signed-off-by: Ryuta Kambe --- .../src/downsample_filter/robin_hood.h | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index b7e94d00f63dd..6edb262a73516 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -2026,41 +2026,6 @@ class Table return emplace(std::move(keyval)).first; } - // Returns 1 if key is found, 0 otherwise. - size_t count(const key_type & key) const - { // NOLINT (modernize-use-nodiscard) - ROBIN_HOOD_TRACE(this) - auto kv = mKeyVals + findIdx(key); - if (kv != reinterpret_cast_no_cast_align_warning(mInfo)) { - return 1; - } - return 0; - } - - template - // NOLINTNEXTLINE (modernize-use-nodiscard) - typename std::enable_if::type count(const OtherKey & key) const - { - ROBIN_HOOD_TRACE(this) - auto kv = mKeyVals + findIdx(key); - if (kv != reinterpret_cast_no_cast_align_warning(mInfo)) { - return 1; - } - return 0; - } - - bool contains(const key_type & key) const - { // NOLINT (modernize-use-nodiscard) - return 1U == count(key); - } - - template - // NOLINTNEXTLINE (modernize-use-nodiscard) - typename std::enable_if::type contains(const OtherKey & key) const - { - return 1U == count(key); - } - // Returns a reference to the value found for key. // Throws std::out_of_range if element cannot be found template From 148e09ed25e8f613f5ba19dc8a7acbc52a226a1a Mon Sep 17 00:00:00 2001 From: veqcc Date: Wed, 3 Jul 2024 17:57:44 +0900 Subject: [PATCH 04/10] restore bitness macros Signed-off-by: veqcc --- .../src/downsample_filter/robin_hood.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 6edb262a73516..a89a98f4c98b1 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -123,6 +123,13 @@ static Counts & counts() // mark unused members with this macro #define ROBIN_HOOD_UNUSED(identifier) +// bitness +#if SIZE_MAX == UINT32_MAX +#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 32 +#else +#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 64 +#endif + // endianess #ifdef _MSC_VER #define ROBIN_HOOD_PRIVATE_DEFINITION_LITTLE_ENDIAN() 1 From bb2f72b8b478cbed7c20b395db0a99f6072068b5 Mon Sep 17 00:00:00 2001 From: veqcc Date: Wed, 3 Jul 2024 18:36:49 +0900 Subject: [PATCH 05/10] remove operator= Signed-off-by: veqcc --- .../src/downsample_filter/robin_hood.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index a89a98f4c98b1..0d8bf1022472d 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -427,14 +427,6 @@ class BulkPoolAllocator return *this; } - BulkPoolAllocator & - // NOLINTNEXTLINE (bugprone-unhandled-self-assignment,cert-oop54-cpp) - operator=(const BulkPoolAllocator & ROBIN_HOOD_UNUSED(o) /*unused*/) noexcept - { - // does not do anything - return *this; - } - ~BulkPoolAllocator() noexcept { reset(); } // Deallocates all allocated memory. From e2da982c54bc1fa9264de863f9fd7ba88e84f8a6 Mon Sep 17 00:00:00 2001 From: veqcc Date: Wed, 3 Jul 2024 18:44:58 +0900 Subject: [PATCH 06/10] remove addOrFree function Signed-off-by: veqcc --- .../src/downsample_filter/robin_hood.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 0d8bf1022472d..d99ff04af66eb 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -465,22 +465,6 @@ class BulkPoolAllocator mHead = obj; } - // Adds an already allocated block of memory to the allocator. This allocator is from now on - // responsible for freeing the data (with free()). If the provided data is not large enough to - // make use of, it is immediately freed. Otherwise it is reused and freed in the destructor. - void addOrFree(void * ptr, const size_t numBytes) noexcept - { - // calculate number of available elements in ptr - if (numBytes < ALIGNMENT + ALIGNED_SIZE) { - // not enough data for at least one element. Free and return. - ROBIN_HOOD_LOG("std::free") - std::free(ptr); - } else { - ROBIN_HOOD_LOG("add to buffer") - add(ptr, numBytes); - } - } - void swap(BulkPoolAllocator & other) noexcept { using std::swap; From 2e6d1422ae7bf1d9b28cf613d3af84bbe6682ddd Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Thu, 4 Jul 2024 18:59:51 +0900 Subject: [PATCH 07/10] add cppcheck suppression Signed-off-by: Ryuta Kambe --- .../pointcloud_preprocessor/src/downsample_filter/robin_hood.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index d99ff04af66eb..88d6c4b6922c5 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -166,7 +166,7 @@ static Counts & counts() #define ROBIN_HOOD_COUNT_TRAILING_ZEROES(x) \ [](size_t mask) noexcept -> int { \ unsigned long index; \ // NOLINT - return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast(index) \ + return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast(index) \ // cppcheck-suppress syntaxError : ROBIN_HOOD(BITNESS); \ }(x) #else From e9794cf7314b736de928bcfb524f0abe831fe9fd Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Thu, 4 Jul 2024 19:04:00 +0900 Subject: [PATCH 08/10] add cppcheck suppression Signed-off-by: Ryuta Kambe --- .../pointcloud_preprocessor/src/downsample_filter/robin_hood.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 88d6c4b6922c5..506b31d0b22c4 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -167,7 +167,7 @@ static Counts & counts() [](size_t mask) noexcept -> int { \ unsigned long index; \ // NOLINT return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast(index) \ // cppcheck-suppress syntaxError - : ROBIN_HOOD(BITNESS); \ + : ROBIN_HOOD(BITNESS); \ // cppcheck-suppress syntaxError }(x) #else #if ROBIN_HOOD(BITNESS) == 32 From 68eee613897c1a7776bb1dd6939a2e288316eade Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Thu, 4 Jul 2024 19:06:11 +0900 Subject: [PATCH 09/10] add cppcheck suppression Signed-off-by: Ryuta Kambe --- .../pointcloud_preprocessor/src/downsample_filter/robin_hood.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 506b31d0b22c4..1cc1fa7c26c95 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -168,7 +168,7 @@ static Counts & counts() unsigned long index; \ // NOLINT return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast(index) \ // cppcheck-suppress syntaxError : ROBIN_HOOD(BITNESS); \ // cppcheck-suppress syntaxError - }(x) + }(x) // cppcheck-suppress syntaxError #else #if ROBIN_HOOD(BITNESS) == 32 #define ROBIN_HOOD_PRIVATE_DEFINITION_CTZ() __builtin_ctzl From 9edc71933a92b2a0be2938e4c6f270a058a49b13 Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Thu, 4 Jul 2024 22:01:21 +0900 Subject: [PATCH 10/10] add cppcheck suppression Signed-off-by: Ryuta Kambe --- .../src/downsample_filter/robin_hood.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h index 1cc1fa7c26c95..edbc55c8158c0 100644 --- a/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h +++ b/sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h @@ -163,11 +163,12 @@ static Counts & counts() #endif #include #pragma intrinsic(ROBIN_HOOD(BITSCANFORWARD)) -#define ROBIN_HOOD_COUNT_TRAILING_ZEROES(x) \ - [](size_t mask) noexcept -> int { \ - unsigned long index; \ // NOLINT - return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast(index) \ // cppcheck-suppress syntaxError - : ROBIN_HOOD(BITNESS); \ // cppcheck-suppress syntaxError +#define ROBIN_HOOD_COUNT_TRAILING_ZEROES(x) \ + [](size_t mask) noexcept -> int { \ + unsigned long index; \ // NOLINT + return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) \ // NOLINT + ? static_cast(index) \ // cppcheck-suppress syntaxError + : ROBIN_HOOD(BITNESS); \ // cppcheck-suppress syntaxError }(x) // cppcheck-suppress syntaxError #else #if ROBIN_HOOD(BITNESS) == 32