Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1394 Fix more warnings in vector.hpp & uninitiali…
Browse files Browse the repository at this point in the history
…zed_array.hpp

Signed-off-by: Jeff Ithier <[email protected]>
  • Loading branch information
orecham committed Feb 8, 2023
1 parent 18e7b34 commit 5badc6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions iceoryx_hoofs/container/include/iox/uninitialized_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]{};
};
Expand All @@ -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];
};
Expand All @@ -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 <typename ElementType, uint64_t Capacity, template <typename, uint64_t> class Buffer = NonZeroedBuffer>
class UninitializedArray final
{
Expand Down Expand Up @@ -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<ElementType, Capacity> m_buffer;
};

Expand Down
3 changes: 1 addition & 2 deletions iceoryx_hoofs/container/include/iox/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, Capacity> m_data{};
uint64_t m_size{0U};
};
Expand Down

0 comments on commit 5badc6f

Please sign in to comment.