Skip to content

Commit 18e7b34

Browse files
authored
Merge pull request #1882 from ithier/iox-1394-fix-axivion-warnings-in-buffer-and-container-modules-2
Fix more warnings in vector.inl & stack.inl
2 parents e043656 + 5fe8b4e commit 18e7b34

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

iceoryx_hoofs/buffer/include/iox/detail/stack.inl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ inline bool stack<T, Capacity>::push(Targs&&... args) noexcept
159159
return false;
160160
}
161161

162-
// AXIVION Next Line AutosarC++19_03-A18.5.10 : every entry of m_data is aligned to alignof(T)
163-
// AXIVION Next Line FaultDetection-IndirectAssignmentOverflow : False positive. Size at
164-
// location guaranteed by T.
162+
// AXIVION Next Construct AutosarC++19_03-A18.5.10 : every entry of m_data is aligned to alignof(T)
163+
// AXIVION Next Construct FaultDetection-IndirectAssignmentOverflow : Size guaranteed by T.
165164
new (&m_data[m_size++]) T(std::forward<Targs>(args)...);
166165
return true;
167166
}

iceoryx_hoofs/container/include/iox/detail/vector.inl

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ inline vector<T, Capacity>::vector(const uint64_t count) noexcept
5050
m_size = std::min(count, Capacity);
5151
for (uint64_t i{0U}; i < m_size; ++i)
5252
{
53-
// AXIVION Next Line AutosarC++19_03-A18.5.2 : false positive, it is a placement new
54-
// AXIVION Next Line FaultDetection-IndirectAssignmentOverflow : False positive. Size at
55-
// location guaranteed by T.
53+
// AXIVION Next Line AutosarC++19_03-A18.5.2, FaultDetection-IndirectAssignmentOverflow : False positive, it is a placement new. Size guaranteed by T.
5654
new (&at(i)) T();
5755
}
5856
}
@@ -87,8 +85,7 @@ inline vector<T, Capacity>& vector<T, Capacity>::operator=(const vector& rhs) no
8785
// copy using copy assignment
8886
for (; i < minSize; ++i)
8987
{
90-
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
91-
// Evaluation order is inconsequential.
88+
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment. Evaluation order is inconsequential.
9289
at(i) = rhs.at(i);
9390
}
9491

@@ -118,8 +115,7 @@ inline vector<T, Capacity>& vector<T, Capacity>::operator=(vector&& rhs) noexcep
118115
// move using move assignment
119116
for (; i < minSize; ++i)
120117
{
121-
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
122-
// Evaluation order is inconsequential.
118+
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment. Evaluation order is inconsequential.
123119
at(i) = std::move(rhs.at(i));
124120
}
125121

@@ -168,9 +164,7 @@ inline bool vector<T, Capacity>::emplace_back(Targs&&... args) noexcept
168164
{
169165
if (m_size < Capacity)
170166
{
171-
// AXIVION Next Construct FaultDetection-IndirectAssignmentOverflow : False positive. Size at
172-
// location guaranteed by T
173-
// AXIVION Next Construct AutosarC++19_03-A5.0.1 : Evaluation order is inconsequential.
167+
// AXIVION Next Line AutosarC++19_03-A5.0.1, FaultDetection-IndirectAssignmentOverflow: Size guaranteed by T. Evaluation order is inconsequential.
174168
new (&at(m_size++)) T(std::forward<Targs>(args)...);
175169
return true;
176170
}
@@ -181,7 +175,7 @@ template <typename T, uint64_t Capacity>
181175
template <typename... Targs>
182176
inline bool vector<T, Capacity>::emplace(const uint64_t position, Targs&&... args) noexcept
183177
{
184-
const uint64_t sizeBeforeEmplace = m_size;
178+
const uint64_t sizeBeforeEmplace{m_size};
185179
if ((m_size >= Capacity) || ((position >= Capacity) || (position > sizeBeforeEmplace)))
186180
{
187181
return false;
@@ -347,7 +341,7 @@ inline typename vector<T, Capacity>::iterator vector<T, Capacity>::end() noexcep
347341
template <typename T, uint64_t Capacity>
348342
inline typename vector<T, Capacity>::const_iterator vector<T, Capacity>::end() const noexcept
349343
{
350-
// AXIVION Next Construct AutosarC++19_03-A5.2.4 : Type-safety ensured by template parameter
344+
// AXIVION Next Construct AutosarC++19_03-A5.2.4, AutosarC++19_03-A5.0.4, AutosarC++19_03-M5.0.15 : Type-safety ensured by template parameter.
351345
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
352346
return reinterpret_cast<const_iterator>(&(at_unchecked(0)) + m_size);
353347
}
@@ -362,8 +356,7 @@ inline bool vector<T, Capacity>::erase(iterator position) noexcept
362356
size_t n{index};
363357
while ((n + 1U) < size())
364358
{
365-
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
366-
// Evaluation order is inconsequential.
359+
// AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment. Evaluation order is inconsequential.
367360
at(n) = std::move(at(n + 1U));
368361
++n;
369362
}

0 commit comments

Comments
 (0)