Skip to content

Commit 0f5a44a

Browse files
[#2499] Restore platform specific attributes
1 parent 70366d7 commit 0f5a44a

File tree

26 files changed

+342
-73
lines changed

26 files changed

+342
-73
lines changed

iceoryx_hoofs/container/include/iox/fixed_position_container.hpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,55 +127,55 @@ class FixedPositionContainer final
127127

128128
/// @brief Checks if the container is empty
129129
/// @return 'true' if the container is empty, 'false' otherwise
130-
[[nodiscard]] bool empty() const noexcept;
130+
IOX_NO_DISCARD bool empty() const noexcept;
131131

132132
/// @brief Checks if the container is full
133133
/// @return 'true' if the container is full, 'false' otherwise
134-
[[nodiscard]] bool full() const noexcept;
134+
IOX_NO_DISCARD bool full() const noexcept;
135135

136136
/// @brief Get the number of used slots in the container
137137
/// @return the number of used slots
138-
[[nodiscard]] uint64_t size() const noexcept;
138+
IOX_NO_DISCARD uint64_t size() const noexcept;
139139

140140
/// @brief Get the capacity of the container
141141
/// @return the number of available slots
142-
[[nodiscard]] constexpr uint64_t capacity() const noexcept;
142+
IOX_NO_DISCARD constexpr uint64_t capacity() const noexcept;
143143

144144
/// @brief Get the iterator to the element pointed to by the index
145145
/// @param[in] index of the element the for the iterator
146146
/// @return iterator pointing to the element at index or end iterator if index was out of bounds or index pointed to
147147
/// an empty slot
148-
[[nodiscard]] Iterator iter_from_index(const IndexType index);
148+
IOX_NO_DISCARD Iterator iter_from_index(const IndexType index);
149149

150150
/// @brief Get the const iterator to the element pointed to by the index
151151
/// @param[in] index of the element the for the iterator
152152
/// @return iterator pointing to the element at index or end iterator if index was out of bounds or index pointed to
153153
/// an empty slot
154-
[[nodiscard]] ConstIterator iter_from_index(const IndexType index) const;
154+
IOX_NO_DISCARD ConstIterator iter_from_index(const IndexType index) const;
155155

156156
/// @brief Get an iterator pointing to the beginning of the container
157157
/// @return iterator pointing to the beginning of the container
158-
[[nodiscard]] Iterator begin() noexcept;
158+
IOX_NO_DISCARD Iterator begin() noexcept;
159159

160160
/// @brief Get a const iterator pointing to the beginning of the container
161161
/// @return const iterator pointing to the beginning of the container
162-
[[nodiscard]] ConstIterator begin() const noexcept;
162+
IOX_NO_DISCARD ConstIterator begin() const noexcept;
163163

164164
/// @brief Get a const iterator pointing to the beginning of the container
165165
/// @return const iterator pointing to the beginning of the container
166-
[[nodiscard]] ConstIterator cbegin() const noexcept;
166+
IOX_NO_DISCARD ConstIterator cbegin() const noexcept;
167167

168168
/// @brief Get an iterator pointing to the end of the container
169169
/// @return iterator pointing to the end of the container
170-
[[nodiscard]] Iterator end() noexcept;
170+
IOX_NO_DISCARD Iterator end() noexcept;
171171

172172
/// @brief Get a const iterator pointing to the end of the container
173173
/// @return const iterator pointing to the end of the container
174-
[[nodiscard]] ConstIterator end() const noexcept;
174+
IOX_NO_DISCARD ConstIterator end() const noexcept;
175175

176176
/// @brief Get a const iterator pointing to the end of the container
177177
/// @return const iterator pointing to the end of the container
178-
[[nodiscard]] ConstIterator cend() const noexcept;
178+
IOX_NO_DISCARD ConstIterator cend() const noexcept;
179179

180180
private:
181181
enum class SlotStatus : uint8_t
@@ -237,7 +237,7 @@ class FixedPositionContainer final
237237
/// @attention aborts if the iterator
238238
/// - is an 'end' iterator
239239
/// - the slot the iterator point to is not in use
240-
[[nodiscard]] Value& operator*() const
240+
IOX_NO_DISCARD Value& operator*() const
241241
{
242242
IOX_ENFORCE(m_index <= Index::LAST, "Access with invalid index!");
243243
IOX_ENFORCE(m_container.get().m_status[m_index] == SlotStatus::USED, "Invalid access! Slot not in use!");
@@ -249,7 +249,7 @@ class FixedPositionContainer final
249249
/// @attention aborts if the iterator
250250
/// - is an 'end' iterator
251251
/// - the slot the iterator point to is not in use
252-
[[nodiscard]] Value* operator->() const
252+
IOX_NO_DISCARD Value* operator->() const
253253
{
254254
IOX_ENFORCE(m_index <= Index::LAST, "Access with invalid index!");
255255
IOX_ENFORCE(m_container.get().m_status[m_index] == SlotStatus::USED, "Invalid access! Slot not in use!");
@@ -261,7 +261,7 @@ class FixedPositionContainer final
261261
/// @attention aborts if the iterator
262262
/// - is an 'end' iterator
263263
/// - the slot the iterator point to is not in use
264-
[[nodiscard]] Value* to_ptr() const
264+
IOX_NO_DISCARD Value* to_ptr() const
265265
{
266266
IOX_ENFORCE(m_index <= Index::LAST, "Access with invalid index!");
267267
IOX_ENFORCE(m_container.get().m_status[m_index] == SlotStatus::USED, "Invalid access! Slot not in use!");
@@ -271,31 +271,31 @@ class FixedPositionContainer final
271271
/// @brief Get the index of the element the iterator points to
272272
/// @return index of the element the iterator points to
273273
/// @attention this can point out of the container in case of the 'end' iterator
274-
[[nodiscard]] IndexType to_index() const
274+
IOX_NO_DISCARD IndexType to_index() const
275275
{
276276
return m_index;
277277
}
278278

279279
/// @brief Check if the iterator origins from the provided container
280280
/// @param[in] container to determine the origin of the iterator
281281
/// @return 'true' if the iterator origins from the provide container, 'false' otherwise
282-
[[nodiscard]] bool origins_from(const Container& container) const
282+
IOX_NO_DISCARD bool origins_from(const Container& container) const
283283
{
284284
return &m_container.get() == &container;
285285
}
286286

287287
/// @brief Compares iterators for equality
288288
/// @return 'true' if iterators are the same, 'false' otherwise
289289
template <IterMutability RHS_TYPE>
290-
[[nodiscard]] bool operator==(const IteratorBase<RHS_TYPE>& rhs) const
290+
IOX_NO_DISCARD bool operator==(const IteratorBase<RHS_TYPE>& rhs) const
291291
{
292292
return origins_from(rhs.m_container.get()) && (m_index == rhs.m_index);
293293
}
294294

295295
/// @brief Compares iterators for non-equality
296296
/// @return 'true' if iterators are not the same, 'false' otherwise
297297
template <IterMutability RHS_TYPE>
298-
[[nodiscard]] bool operator!=(const IteratorBase<RHS_TYPE>& rhs) const
298+
IOX_NO_DISCARD bool operator!=(const IteratorBase<RHS_TYPE>& rhs) const
299299
{
300300
return !(*this == rhs);
301301
}

iceoryx_hoofs/legacy/include/iceoryx_hoofs/cxx/attributes.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,4 @@ using iox::internal::IOX_DISCARD_RESULT_IMPL;
3838

3939
// clang-format on
4040

41-
/// @deprecated use '[[nodiscard]]' instead of 'IOX_NO_DISCARD'
42-
#define IOX_NO_DISCARD [[nodiscard, IOX_NO_DISCARD_is_deprecated_use__nodiscard__attribute]]
43-
44-
/// @deprecated use '[[fallthrough]]' instead of 'IOX_FALLTHROUGH'
45-
#define IOX_FALLTHROUGH [[fallthrough, IOX_FALLTHROUGH_is_deprecated_use__fallthrough__attribute]]
46-
47-
/// @deprecated use '[[maybe_unused]]' instead of 'IOX_MAYBE_UNUSED'
48-
#define IOX_MAYBE_UNUSED [[maybe_unused, IOX_MAYBE_UNUSED_is_deprecated_use__maybe_unused__attribute]]
49-
5041
#endif

iceoryx_hoofs/posix/design/include/iox/detail/posix_call.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ inline PosixCallDetails<ReturnType>::PosixCallDetails(const char* posixFunctionN
5858
/// of "strerror_r", the posix compliant one which returns an int and stores the message in the buffer
5959
/// and a gnu version which returns a pointer to the message and sometimes stores the message
6060
/// in the buffer
61-
inline string<POSIX_CALL_ERROR_STRING_SIZE> errorLiteralToString(const int returnCode [[maybe_unused]],
61+
inline string<POSIX_CALL_ERROR_STRING_SIZE> errorLiteralToString(const int returnCode IOX_MAYBE_UNUSED,
6262
char* const buffer)
6363
{
6464
return string<POSIX_CALL_ERROR_STRING_SIZE>(TruncateToCapacity, buffer);
6565
}
6666

67-
inline string<POSIX_CALL_ERROR_STRING_SIZE> errorLiteralToString(const char* msg, char* const buffer [[maybe_unused]])
67+
inline string<POSIX_CALL_ERROR_STRING_SIZE> errorLiteralToString(const char* msg, char* const buffer IOX_MAYBE_UNUSED)
6868
{
6969
return string<POSIX_CALL_ERROR_STRING_SIZE>(TruncateToCapacity, msg);
7070
}

iceoryx_hoofs/posix/design/include/iox/posix_call.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct PosixCallDetails
7979

8080
/// @brief class which is created by the verificator to evaluate the result of a posix call
8181
template <typename ReturnType>
82-
class [[nodiscard]] PosixCallEvaluator
82+
class IOX_NO_DISCARD PosixCallEvaluator
8383
{
8484
public:
8585
/// @brief ignore specified errnos from the evaluation
@@ -115,7 +115,7 @@ class [[nodiscard]] PosixCallEvaluator
115115

116116
/// @brief class which verifies the return value of a posix function call
117117
template <typename ReturnType>
118-
class [[nodiscard]] PosixCallVerificator
118+
class IOX_NO_DISCARD PosixCallVerificator
119119
{
120120
public:
121121
/// @brief the posix function call defines success through a single value
@@ -147,7 +147,7 @@ class [[nodiscard]] PosixCallVerificator
147147
};
148148

149149
template <typename ReturnType, typename... FunctionArguments>
150-
class [[nodiscard]] PosixCallBuilder
150+
class IOX_NO_DISCARD PosixCallBuilder
151151
{
152152
public:
153153
/// @brief input function type

iceoryx_hoofs/primitives/include/iox/attributes.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef IOX_HOOFS_PRIMITIVES_ATTRIBUTES_HPP
1818
#define IOX_HOOFS_PRIMITIVES_ATTRIBUTES_HPP
1919

20+
#include "iceoryx_platform/attributes.hpp"
21+
2022
namespace iox
2123
{
2224
namespace internal

iceoryx_hoofs/test/moduletests/test_container_fixed_position_container.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,9 +2988,9 @@ TEST_F(FixedPositionContainer_test, DereferencingEndIteratorCallsErrorHandler)
29882988
{
29892989
::testing::Test::RecordProperty("TEST_ID", "f2ccf248-97f8-4265-9bb4-9c8e7cb79e67");
29902990

2991-
IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = *sut.end(); }, iox::er::ENFORCE_VIOLATION);
2991+
IOX_EXPECT_FATAL_FAILURE([&] { auto _ IOX_MAYBE_UNUSED = *sut.end(); }, iox::er::ENFORCE_VIOLATION);
29922992

2993-
IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = *sut.cend(); }, iox::er::ENFORCE_VIOLATION);
2993+
IOX_EXPECT_FATAL_FAILURE([&] { auto _ IOX_MAYBE_UNUSED = *sut.cend(); }, iox::er::ENFORCE_VIOLATION);
29942994
}
29952995

29962996
TEST_F(FixedPositionContainer_test, DereferencingInvalidIteratorCallsErrorHandler)
@@ -3000,7 +3000,7 @@ TEST_F(FixedPositionContainer_test, DereferencingInvalidIteratorCallsErrorHandle
30003000
auto it = sut.emplace(135U);
30013001
sut.erase(it);
30023002

3003-
IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = *it; }, iox::er::ENFORCE_VIOLATION);
3003+
IOX_EXPECT_FATAL_FAILURE([&] { auto _ IOX_MAYBE_UNUSED = *it; }, iox::er::ENFORCE_VIOLATION);
30043004
}
30053005

30063006
TEST_F(FixedPositionContainer_test, ArrowOperatorOnNonConstItertorLeadsToNonConstPointer)
@@ -3117,9 +3117,9 @@ TEST_F(FixedPositionContainer_test, ToPtrOnEndIteratorCallsErrorHandler)
31173117
{
31183118
::testing::Test::RecordProperty("TEST_ID", "51b76d04-6c8c-486e-88c9-8b6b760c41d4");
31193119

3120-
IOX_EXPECT_FATAL_FAILURE([&] { auto* _ [[maybe_unused]] = sut.end().to_ptr(); }, iox::er::ENFORCE_VIOLATION);
3120+
IOX_EXPECT_FATAL_FAILURE([&] { auto* _ IOX_MAYBE_UNUSED = sut.end().to_ptr(); }, iox::er::ENFORCE_VIOLATION);
31213121

3122-
IOX_EXPECT_FATAL_FAILURE([&] { const auto* _ [[maybe_unused]] = sut.cend().to_ptr(); }, iox::er::ENFORCE_VIOLATION);
3122+
IOX_EXPECT_FATAL_FAILURE([&] { const auto* _ IOX_MAYBE_UNUSED = sut.cend().to_ptr(); }, iox::er::ENFORCE_VIOLATION);
31233123
}
31243124

31253125
TEST_F(FixedPositionContainer_test, ToPtrOnInvalidIteratorCallsErrorHandler)
@@ -3129,7 +3129,7 @@ TEST_F(FixedPositionContainer_test, ToPtrOnInvalidIteratorCallsErrorHandler)
31293129
auto it = sut.emplace(135U);
31303130
sut.erase(it);
31313131

3132-
IOX_EXPECT_FATAL_FAILURE([&] { auto* _ [[maybe_unused]] = it.to_ptr(); }, iox::er::ENFORCE_VIOLATION);
3132+
IOX_EXPECT_FATAL_FAILURE([&] { auto* _ IOX_MAYBE_UNUSED = it.to_ptr(); }, iox::er::ENFORCE_VIOLATION);
31333133
}
31343134

31353135
TEST_F(FixedPositionContainer_test, ToIndexOnIteratorReturnsCorrespondingIndex)
@@ -3267,8 +3267,8 @@ TEST_F(FixedPositionContainer_test, IteratorDestructorDoesNotDestroyObjectItPoin
32673267
fillSutComplex();
32683268

32693269
{
3270-
auto it [[maybe_unused]] = sut_complex.begin();
3271-
auto cit [[maybe_unused]] = sut_complex.cbegin();
3270+
auto it IOX_MAYBE_UNUSED = sut_complex.begin();
3271+
auto cit IOX_MAYBE_UNUSED = sut_complex.cbegin();
32723272
}
32733273

32743274
EXPECT_THAT(stats.dTor, Eq(0));

iceoryx_hoofs/test/moduletests/test_container_forward_list.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ TEST_F(forward_list_test, InsertAfterSomeElementsListLValue)
876876
}
877877
sut.insert_after(iter, a);
878878

879-
for (auto& x [[maybe_unused]] : sut)
879+
for (auto& x IOX_MAYBE_UNUSED : sut)
880880
{
881881
++loopCounter;
882882
}
@@ -1146,7 +1146,7 @@ TEST_F(forward_list_test, IteratorTraitsGetValueType)
11461146
TEST_F(forward_list_test, IteratorTraitsCheckIteratorCategoryOnConstIterator)
11471147
{
11481148
::testing::Test::RecordProperty("TEST_ID", "ffbb06eb-5267-45e0-91e4-6172a27a3489");
1149-
auto iter [[maybe_unused]] = sut.cbefore_begin();
1149+
auto iter IOX_MAYBE_UNUSED = sut.cbefore_begin();
11501150
ASSERT_NE(typeid(std::iterator_traits<decltype(iter)>::iterator_category), typeid(std::random_access_iterator_tag));
11511151
EXPECT_EQ(typeid(std::iterator_traits<decltype(iter)>::iterator_category), typeid(std::forward_iterator_tag));
11521152
}

iceoryx_hoofs/test/moduletests/test_container_list.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ TEST_F(list_test, InsertSomeElementsListLValue)
11601160
}
11611161
sut.insert(iter, a);
11621162

1163-
for (auto& x [[maybe_unused]] : sut)
1163+
for (auto& x IOX_MAYBE_UNUSED : sut)
11641164
{
11651165
++loopCounter;
11661166
}
@@ -1478,7 +1478,7 @@ TEST_F(list_test, IteratorTraitsGetValueType)
14781478
TEST_F(list_test, IteratorTraitsCheckIteratorCategoryOnConstIterator)
14791479
{
14801480
::testing::Test::RecordProperty("TEST_ID", "295e6406-93bc-4a12-9b03-33e5d494b2c2");
1481-
auto iter [[maybe_unused]] = sut.cbegin();
1481+
auto iter IOX_MAYBE_UNUSED = sut.cbegin();
14821482
ASSERT_NE(typeid(std::iterator_traits<decltype(iter)>::iterator_category), typeid(std::random_access_iterator_tag));
14831483
EXPECT_EQ(typeid(std::iterator_traits<decltype(iter)>::iterator_category), typeid(std::bidirectional_iterator_tag));
14841484
}
@@ -2259,7 +2259,7 @@ TEST_F(list_test, invalidIteratorComparison)
22592259

22602260
auto iter = sut.cbegin();
22612261
++iter;
2262-
auto iter2 [[maybe_unused]] = sut.erase(iter);
2262+
auto iter2 IOX_MAYBE_UNUSED = sut.erase(iter);
22632263

22642264

22652265
IOX_EXPECT_FATAL_FAILURE([&] { IOX_DISCARD_RESULT(sut.cbegin() == iter); }, iox::er::ENFORCE_VIOLATION);
@@ -2293,7 +2293,7 @@ TEST_F(list_test, invalidIteratorDereferencing)
22932293

22942294
auto iter = sut.cbegin();
22952295
++iter;
2296-
auto iter2 [[maybe_unused]] = sut.erase(iter);
2296+
auto iter2 IOX_MAYBE_UNUSED = sut.erase(iter);
22972297

22982298
IOX_EXPECT_FATAL_FAILURE([&] { IOX_DISCARD_RESULT((*iter).value); }, iox::er::ENFORCE_VIOLATION);
22992299
}
@@ -2309,7 +2309,7 @@ TEST_F(list_test, invalidIteratorAddressOfOperator)
23092309

23102310
auto iter = sut.cbegin();
23112311
++iter;
2312-
auto iter2 [[maybe_unused]] = sut.erase(iter);
2312+
auto iter2 IOX_MAYBE_UNUSED = sut.erase(iter);
23132313

23142314
IOX_EXPECT_FATAL_FAILURE([&] { IOX_DISCARD_RESULT(iter->value == 12U); }, iox::er::ENFORCE_VIOLATION);
23152315
}

iceoryx_hoofs/test/moduletests/test_design_functional_interface_expect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ template <>
121121
struct ExpectReturnsValueWhenValid<TYPE_HAS_NO_VALUE_METHOD>
122122
{
123123
template <typename TestFactory, typename ExpectCall>
124-
static void performTest(const ExpectCall& callExpect [[maybe_unused]])
124+
static void performTest(const ExpectCall& callExpect IOX_MAYBE_UNUSED)
125125
{
126126
}
127127
};

iceoryx_hoofs/test/moduletests/test_design_functional_interface_value_or.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template <>
4242
struct ValueOrReturnsValueWhenValid<TYPE_HAS_NO_VALUE_METHOD>
4343
{
4444
template <typename TestFactory, typename ValueOrCall>
45-
static void performTest(const ValueOrCall& callValueOr [[maybe_unused]])
45+
static void performTest(const ValueOrCall& callValueOr IOX_MAYBE_UNUSED)
4646
{
4747
}
4848
};
@@ -77,7 +77,7 @@ template <>
7777
struct ValueOrReturnsArgumentWhenInalid<TYPE_HAS_NO_VALUE_METHOD>
7878
{
7979
template <typename TestFactory, typename ValueOrCall>
80-
static void performTest(const ValueOrCall& callValueOr [[maybe_unused]])
80+
static void performTest(const ValueOrCall& callValueOr IOX_MAYBE_UNUSED)
8181
{
8282
}
8383
};

0 commit comments

Comments
 (0)