From 5badc6fbf7c21ddd8a2f0d4e0d3f5ad7e8b565f7 Mon Sep 17 00:00:00 2001 From: Jeff Ithier Date: Wed, 8 Feb 2023 20:53:07 +0100 Subject: [PATCH] iox-#1394 Fix more warnings in vector.hpp & uninitialized_array.hpp Signed-off-by: Jeff Ithier --- .../container/include/iox/uninitialized_array.hpp | 10 ++++++---- iceoryx_hoofs/container/include/iox/vector.hpp | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp index 3de95b7458..d2864030c5 100644 --- a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp +++ b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp @@ -33,11 +33,11 @@ struct ZeroedBuffer { struct alignas(ElementType) element_t { - // AXIVION Next Construct AutosarC++19_03-A18.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction + // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-M0.1.3 : required by low level UninitializedArray building block and encapsulated in abstraction, declaration of field in struct for usage elsewhere // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) cxx::byte_t data[sizeof(ElementType)]; }; - // AXIVION Next Construct AutosarC++19_03-A18.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction + // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-A1.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction, object size limit is not relevant for containers stored in shared memory. // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) element_t value[Capacity]{}; }; @@ -50,11 +50,11 @@ struct NonZeroedBuffer { struct alignas(ElementType) element_t { - // AXIVION Next Construct AutosarC++19_03-A18.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction + // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-M0.1.3 : required by low level UninitializedArray building block and encapsulated in abstraction, declaration of field in struct for usage elsewhere // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) cxx::byte_t data[sizeof(ElementType)]; }; - // AXIVION Next Construct AutosarC++19_03-A18.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction + // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-A1.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction, object size limit is not relevant for containers stored in shared memory // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) element_t value[Capacity]; }; @@ -66,6 +66,7 @@ struct NonZeroedBuffer /// @tparam Buffer is the policy parameter to choose between an uninitialized, not zeroed array (=NonZeroedBuffer, /// default) and an uninitialized array with all elements zeroed (=ZeroedBuffer) /// @note Out of bounds access leads to undefined behavior +// AXIVION Next Construct AutosarC++19_03-A9.6.1 : type contains a single member that is a byte array whos size is defined by ElementType and Capacity template class Buffer = NonZeroedBuffer> class UninitializedArray final { @@ -111,6 +112,7 @@ class UninitializedArray final static constexpr uint64_t capacity() noexcept; private: + // AXIVION Next Construct AutosarC++19_03-A1.1.1 : object size limit is not relevant for containers stored in shared memory Buffer m_buffer; }; diff --git a/iceoryx_hoofs/container/include/iox/vector.hpp b/iceoryx_hoofs/container/include/iox/vector.hpp index 87e13bbf8d..184de78418 100644 --- a/iceoryx_hoofs/container/include/iox/vector.hpp +++ b/iceoryx_hoofs/container/include/iox/vector.hpp @@ -218,8 +218,7 @@ class vector final void clearFrom(const uint64_t startPosition) noexcept; - // AXIVION Next Construct AutosarC++19_03-A1.1.1 : Object size limit is not relevant for - // containers stored in shared memory. + // AXIVION Next Construct AutosarC++19_03-A1.1.1 : Object size limit is not relevant for containers stored in shared memory. UninitializedArray m_data{}; uint64_t m_size{0U}; };