From fa58f6e04999fb060b86a20acf5798d080d97f78 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 00:32:46 +0100 Subject: [PATCH 01/18] iox-#2130 Move 'vocabulary' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- iceoryx_dust/BUILD.bazel | 3 +- iceoryx_dust/CMakeLists.txt | 2 - iceoryx_hoofs/README.md | 1 + .../test/moduletests/test_vocabulary_span.cpp | 133 ++++++++++-------- .../vocabulary/include/iox/detail/span.inl | 7 +- .../include/iox/detail/span_iterator.hpp | 14 +- .../vocabulary/include/iox/span.hpp | 7 +- 7 files changed, 94 insertions(+), 73 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_vocabulary_span.cpp (70%) rename {iceoryx_dust => iceoryx_hoofs}/vocabulary/include/iox/detail/span.inl (98%) rename {iceoryx_dust => iceoryx_hoofs}/vocabulary/include/iox/detail/span_iterator.hpp (95%) rename {iceoryx_dust => iceoryx_hoofs}/vocabulary/include/iox/span.hpp (99%) diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel index fd6f6a8699..2362c63694 100644 --- a/iceoryx_dust/BUILD.bazel +++ b/iceoryx_dust/BUILD.bazel @@ -35,7 +35,7 @@ cc_library( "posix/ipc/source/**/*.cpp", "posix/sync/source/**/*.cpp", ]), - hdrs = glob(["cli/**"]) + glob(["container/**"]) + glob(["filesystem/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + glob(["vocabulary/**"]) + [ + hdrs = glob(["cli/**"]) + glob(["container/**"]) + glob(["filesystem/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ ":iceoryx_dust_deployment_hpp", ], includes = [ @@ -47,7 +47,6 @@ cc_library( "posix/ipc/include/", "posix/sync/include/", "utility/include/", - "vocabulary/include/", ], visibility = ["//visibility:public"], deps = ["//iceoryx_hoofs"], diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index f059e2a5ea..9bbba355f8 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -53,7 +53,6 @@ iox_add_library( ${PROJECT_SOURCE_DIR}/posix/ipc/include ${PROJECT_SOURCE_DIR}/posix/sync/include ${PROJECT_SOURCE_DIR}/utility/include - ${PROJECT_SOURCE_DIR}/vocabulary/include ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS cli/include/ @@ -63,7 +62,6 @@ iox_add_library( posix/ipc/include/ posix/sync/include/ utility/include/ - vocabulary/include/ FILES cli/source/arguments.cpp cli/source/command_line_parser.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 81a68797d2..e7b3993d47 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -51,6 +51,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`variant` | | C++11 implementation of the C++17 feature `std::variant` | |`expected` | | Our base class used in error handling. Every function which can fail should return an expected. With this the user knows that this function can fail and that they have to do some kind of error handling. We got inspired by the [C++ expected proposal]( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0323r7.html) and by the [rust error handling concept](https://doc.rust-lang.org/std/result/enum.Result.html). | |`string` | | Heap and exception free implementation of `std::string`. Attention, since the string is stack based, std::string or char array which are assigned to this string will be truncated and zero-terminated if they exceed the string capacity. | +|`span` | | C++17 implementation of the C++20 feature `std::span` | ### Filesystem (filesystem) diff --git a/iceoryx_dust/test/moduletests/test_vocabulary_span.cpp b/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp similarity index 70% rename from iceoryx_dust/test/moduletests/test_vocabulary_span.cpp rename to iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp index cf3e4dea3a..ffbd23fe40 100644 --- a/iceoryx_dust/test/moduletests/test_vocabulary_span.cpp +++ b/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp @@ -28,9 +28,9 @@ using namespace iox; TEST(span_test, NewEmptySpanCreatedFromIteratorContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "59980664-c94f-4bb5-bc9d-adeac630746e"); - constexpr int* kNull = nullptr; + constexpr int32_t* kNull = nullptr; - constexpr span empty_sut(kNull, 0); + constexpr span empty_sut(kNull, 0); ASSERT_TRUE(empty_sut.empty()); EXPECT_EQ(nullptr, empty_sut.data()); @@ -39,10 +39,10 @@ TEST(span_test, NewEmptySpanCreatedFromIteratorContainsSameData) TEST(span_test, NewDynSpanCreatedFromIteratorContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "05db30c2-e13d-4116-ba05-668b30ba4a23"); - const std::vector expected_data = {1, 1, 2, 3, 5, 8}; - std::vector vector = expected_data; + const std::vector expected_data = {1, 1, 2, 3, 5, 8}; + std::vector vector = expected_data; - span dyn_sut(vector.begin(), vector.size()); + span dyn_sut(vector.begin(), vector.size()); EXPECT_EQ(vector.data(), dyn_sut.data()); EXPECT_EQ(vector.size(), dyn_sut.size()); @@ -55,9 +55,9 @@ TEST(span_test, NewDynSpanCreatedFromIteratorContainsSameData) TEST(span_test, NewStaticSpanCreatedFromIteratorContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "fdc6a3fe-3971-4326-b6b2-1967afbc9726"); - std::vector vector = {8, 2, 2, 4, 5, 8}; + std::vector vector = {8, 2, 2, 4, 5, 8}; - span static_sut(vector.begin(), vector.size()); + span static_sut(vector.begin(), vector.size()); EXPECT_EQ(vector.data(), static_sut.data()); EXPECT_EQ(vector.size(), static_sut.size()); @@ -71,9 +71,9 @@ TEST(span_test, NewStaticSpanCreatedFromIteratorContainsSameData) TEST(span_test, NewConstSpanCreatedFromContainerContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "593aa3b6-9937-469d-991d-9e682110727e"); - std::vector vector = {6, 7, 2, 8, 9, 2}; + std::vector vector = {6, 7, 2, 8, 9, 2}; - span const_sut(vector); + span const_sut(vector); EXPECT_EQ(vector.data(), const_sut.data()); EXPECT_EQ(vector.size(), const_sut.size()); @@ -86,9 +86,9 @@ TEST(span_test, NewConstSpanCreatedFromContainerContainsSameData) TEST(span_test, NewDynSpanCreatedFromContainerContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "4b85bc77-2d3b-4a89-b86a-d5c75a4f3c49"); - std::vector vector = {1, 1, 2, 3, 5, 8}; + std::vector vector = {1, 1, 2, 3, 5, 8}; - span dyn_sut(vector); + span dyn_sut(vector); ASSERT_EQ(vector.data(), dyn_sut.data()); ASSERT_EQ(vector.size(), dyn_sut.size()); @@ -101,9 +101,9 @@ TEST(span_test, NewDynSpanCreatedFromContainerContainsSameData) TEST(span_test, NewStaticSpanCreatedFromContainerContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "3a5f3675-2365-4966-ae78-2035bac45db0"); - std::vector vector = {1, 1, 13, 3, 5, 8}; + std::vector vector = {1, 1, 13, 3, 5, 8}; - span static_sut(vector.data(), vector.size()); + span static_sut(vector.data(), vector.size()); ASSERT_EQ(vector.data(), static_sut.data()); ASSERT_EQ(vector.size(), static_sut.size()); @@ -116,54 +116,71 @@ TEST(span_test, NewStaticSpanCreatedFromContainerContainsSameData) TEST(span_test, NewConstSpanCreatedFromArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "bbbd4ce2-30ea-4b32-86e3-aa7d0a1184d8"); - int array[] = {5, 41, 3, 2, 1}; + // NOLINTJUSTIFICATION this is explicitely a test for a C-array + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,-warnings-as-errors) + int32_t array[] = {5, 41, 3, 2, 1}; - span const_sut(array); + span const_sut(array); ASSERT_EQ(array, const_sut.data()); ASSERT_EQ(iox::size(array), const_sut.size()); - for (size_t i = 0; i < const_sut.size(); ++i) + + size_t i = 0; + for (const auto item : array) { - EXPECT_EQ(array[i], const_sut[i]); + EXPECT_EQ(item, const_sut[i]); + ++i; } } TEST(span_test, NewDynSpanCreatedFromArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "3bd35b66-2cf7-42bc-b7b8-5344ac92d8fa"); - int array[] = {5, 24, 3, 22, 1}; + // NOLINTJUSTIFICATION this is explicitely a test for a C-array + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,-warnings-as-errors) + int32_t array[] = {5, 24, 3, 22, 1}; - span dyn_sut(array); + span dyn_sut(array); ASSERT_EQ(array, dyn_sut.data()); ASSERT_EQ(iox::size(array), dyn_sut.size()); - for (size_t i = 0; i < dyn_sut.size(); ++i) + + size_t i = 0; + for (const auto item : array) { - EXPECT_EQ(array[i], dyn_sut[i]); + EXPECT_EQ(item, dyn_sut[i]); + ++i; } } TEST(span_test, NewStaticSpanCreatedFromArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "3dfae2a7-d6eb-4961-a600-0e5d6738c283"); - int array[] = {5, 4, 3, 32, 1}; + // NOLINTJUSTIFICATION this is explicitely a test for a C-array + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,-warnings-as-errors) + int32_t array[] = {5, 4, 3, 32, 1}; - span static_sut(array); + span static_sut(array); ASSERT_EQ(array, static_sut.data()); ASSERT_EQ(iox::size(array), static_sut.size()); - for (size_t i = 0; i < static_sut.size(); ++i) + + size_t i = 0; + for (const auto item : array) { - EXPECT_EQ(array[i], static_sut[i]); + EXPECT_EQ(item, static_sut[i]); + ++i; } } TEST(span_test, NewDynSpanCreatedFromConstexprArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "9ec9c31c-b97f-43a3-9669-3bdff3a82b9e"); - static constexpr int arr[] = {5, 4, 3, 2, 1}; + // NOLINTJUSTIFICATION this is explicitely a test for a C-array + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,-warnings-as-errors) + static constexpr int32_t arr[] = {5, 4, 3, 2, 1}; - constexpr span dyn_sut(arr); + constexpr span dyn_sut(arr); - static_assert(arr == dyn_sut.data(), "Data needs to point to array"); + static_assert(&arr[0] == dyn_sut.data(), "Data needs to point to array"); static_assert(iox::size(arr) == dyn_sut.size(), "Size needs to be the same as array size"); static_assert(arr[0] == dyn_sut[0], "Values need to be the same"); static_assert(arr[1] == dyn_sut[1], "Values need to be the same"); @@ -175,11 +192,13 @@ TEST(span_test, NewDynSpanCreatedFromConstexprArrayContainsSameData) TEST(span_test, NewStaticSpanCreatedFromConstexprArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "e9aa537e-4d6b-48d1-bb04-b621a2d14df6"); - static constexpr int arr[] = {55, 44, 33, 22, 11}; + // NOLINTJUSTIFICATION this is explicitely a test for a C-array + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,-warnings-as-errors) + static constexpr int32_t arr[] = {55, 44, 33, 22, 11}; - constexpr span static_sut(arr); + constexpr span static_sut(arr); - static_assert(arr == static_sut.data(), "Data needs to point to array"); + static_assert(&arr[0] == static_sut.data(), "Data needs to point to array"); static_assert(iox::size(arr) == static_sut.size(), "Size needs to be the same as array size"); static_assert(arr[0] == static_sut[0], "Values need to be the same"); static_assert(arr[1] == static_sut[1], "Values need to be the same"); @@ -191,9 +210,9 @@ TEST(span_test, NewStaticSpanCreatedFromConstexprArrayContainsSameData) TEST(span_test, NewConstSpanFromConstContainerContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "4358e397-c82b-45f7-a75f-8d0b1cf03667"); - const std::vector vector = {1, 1, 2, 3, 5, 8}; + const std::vector vector = {1, 1, 2, 3, 5, 8}; - span const_sut(vector); + span const_sut(vector); ASSERT_EQ(vector.data(), const_sut.data()); ASSERT_EQ(vector.size(), const_sut.size()); @@ -206,9 +225,9 @@ TEST(span_test, NewConstSpanFromConstContainerContainsSameData) TEST(span_test, NewStaticSpanFromConstContainerContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "28f85385-3bdb-4bd1-ad40-2bebe399ac08"); - const std::vector vector = {1, 1, 2, 3, 5, 8}; + const std::vector vector = {1, 1, 2, 3, 5, 8}; - span static_sut(vector.data(), vector.size()); + span static_sut(vector.data(), vector.size()); ASSERT_EQ(vector.data(), static_sut.data()); ASSERT_EQ(vector.size(), static_sut.size()); @@ -222,14 +241,14 @@ TEST(span_test, NewConstSpanFromIoxVectorContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "a7b1177b-0db5-44b8-bacd-b75d25c3a448"); constexpr uint64_t CAPACITY{6U}; - constexpr int DEFAULT_VALUE{1}; - iox::vector vector(CAPACITY, DEFAULT_VALUE); + constexpr int32_t DEFAULT_VALUE{1}; + iox::vector vector(CAPACITY, DEFAULT_VALUE); vector[2] = 2; vector[3] = 3; vector[4] = 5; vector[5] = 7; - span const_sut(vector); + span const_sut(vector); ASSERT_EQ(vector.data(), const_sut.data()); ASSERT_EQ(vector.size(), const_sut.size()); @@ -243,14 +262,14 @@ TEST(span_test, NewStaticSpanFromConstIoxVectorContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "af1bdb48-4cae-4c7d-a830-a098d84fb1aa"); constexpr uint64_t CAPACITY{6U}; - constexpr int DEFAULT_VALUE{1}; - iox::vector vector(CAPACITY, DEFAULT_VALUE); + constexpr int32_t DEFAULT_VALUE{1}; + iox::vector vector(CAPACITY, DEFAULT_VALUE); vector[2] = 22; vector[3] = 33; vector[4] = 55; vector[5] = 77; - span static_sut(vector.data(), vector.size()); + span static_sut(vector.data(), vector.size()); ASSERT_EQ(vector.data(), static_sut.data()); ASSERT_EQ(vector.size(), static_sut.size()); @@ -264,7 +283,7 @@ TEST(span_test, NewConstSpanFromConstIoxUninitializedArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "86ee3995-4267-4650-b1c4-4db8f5cf154b"); constexpr uint64_t CAPACITY{6U}; - iox::UninitializedArray uninitializedArray; + iox::UninitializedArray uninitializedArray; uninitializedArray[0] = 60; uninitializedArray[1] = 41; uninitializedArray[2] = 21; @@ -272,7 +291,7 @@ TEST(span_test, NewConstSpanFromConstIoxUninitializedArrayContainsSameData) uninitializedArray[4] = 53; uninitializedArray[5] = 74; - span const_sut(uninitializedArray); + span const_sut(uninitializedArray); ASSERT_EQ(uninitializedArray.begin(), const_sut.data()); ASSERT_EQ(uninitializedArray.capacity(), const_sut.size()); @@ -286,7 +305,7 @@ TEST(span_test, NewStaticSpanFromConstIoxUninitializedArrayContainsSameData) { ::testing::Test::RecordProperty("TEST_ID", "c6a3f7d2-dbab-4c9f-a405-6ee2cc3f4457"); constexpr uint64_t CAPACITY{6U}; - iox::UninitializedArray uninitializedArray; + iox::UninitializedArray uninitializedArray; uninitializedArray[0] = 66; uninitializedArray[1] = 44; uninitializedArray[2] = 22; @@ -294,7 +313,7 @@ TEST(span_test, NewStaticSpanFromConstIoxUninitializedArrayContainsSameData) uninitializedArray[4] = 55; uninitializedArray[5] = 77; - span static_sut(uninitializedArray.begin(), uninitializedArray.capacity()); + span static_sut(uninitializedArray.begin(), uninitializedArray.capacity()); ASSERT_EQ(uninitializedArray.begin(), static_sut.data()); ASSERT_EQ(uninitializedArray.capacity(), static_sut.size()); @@ -307,16 +326,16 @@ TEST(span_test, NewStaticSpanFromConstIoxUninitializedArrayContainsSameData) TEST(span_test, CheckFrontOfSpanIfItReturnsTheElementAtIndex0) { ::testing::Test::RecordProperty("TEST_ID", "57b2f67f-79c1-4c1e-a305-f4665283c474"); - static constexpr int arr[] = {1, 6, 1, 8, 0}; - constexpr span span(arr); - static_assert(&arr[0] == &span.front(), "span.front() does not refer to the same element as arr[0]"); + static constexpr std::array arr = {1, 6, 2, 8, 0}; + constexpr span span(arr); + static_assert(arr.data() == &span.front(), "span.front() does not refer to the same element as arr[0]"); } TEST(span_test, CheckIterOfSpan) { ::testing::Test::RecordProperty("TEST_ID", "4760addf-87f1-46c2-901a-63cf4de3a6ea"); - static constexpr int arr[] = {1, 6, 1, 8, 0}; - [[maybe_unused]] constexpr span span(arr); + static constexpr std::array arr = {1, 6, 2, 8, 0}; + [[maybe_unused]] constexpr span span(arr); EXPECT_TRUE(1 == span.begin()[0]); // First element needs to be '1' EXPECT_TRUE(1 == *(span.begin() += 0)); // First element needs to be '1' @@ -333,8 +352,8 @@ TEST(span_test, CheckConstexprIterOfSpan) GTEST_SKIP() << "Some GCC versions (especially with address sanitizer) break the 'constexpr' therefore this test " "can only be run with clang!"; #else - static constexpr int arr[] = {1, 6, 1, 8, 0}; - [[maybe_unused]] constexpr span span(arr); + static constexpr std::array arr = {1, 6, 2, 8, 0}; + [[maybe_unused]] constexpr span span(arr); // Explicitly not use EXPECT_TRUE here to be able to execute the test case during compile-time static_assert(1 == span.begin()[0], "First element needs to be '1'"); @@ -349,16 +368,16 @@ TEST(span_test, CheckConstexprIterOfSpan) TEST(span_test, GetSpanDataAsWritableBytes) { ::testing::Test::RecordProperty("TEST_ID", "73ed24f9-c2ea-467a-b64e-e53e97247e8d"); - std::vector vec = {1, 41, 2, 3, 5, 85}; + std::vector vec = {1, 41, 2, 3, 5, 85}; - span mutable_sut(vec); + span mutable_sut(vec); span writable_bytes_sut = as_writable_bytes(mutable_sut); - EXPECT_EQ(reinterpret_cast(vec.data()), writable_bytes_sut.data()); - EXPECT_EQ(sizeof(int) * vec.size(), writable_bytes_sut.size()); + EXPECT_EQ(static_cast(vec.data()), static_cast(writable_bytes_sut.data())); + EXPECT_EQ(sizeof(int32_t) * vec.size(), writable_bytes_sut.size()); EXPECT_EQ(writable_bytes_sut.size(), writable_bytes_sut.size_bytes()); // Set the first entry of vec to zero while writing through the span. - std::fill(writable_bytes_sut.data(), writable_bytes_sut.data() + sizeof(int), 0); + std::fill(writable_bytes_sut.begin(), writable_bytes_sut.begin() + sizeof(int32_t), 0); EXPECT_EQ(0, vec[0]); } diff --git a/iceoryx_dust/vocabulary/include/iox/detail/span.inl b/iceoryx_hoofs/vocabulary/include/iox/detail/span.inl similarity index 98% rename from iceoryx_dust/vocabulary/include/iox/detail/span.inl rename to iceoryx_hoofs/vocabulary/include/iox/detail/span.inl index 7f7abbf51a..2cb19e5856 100644 --- a/iceoryx_dust/vocabulary/include/iox/detail/span.inl +++ b/iceoryx_hoofs/vocabulary/include/iox/detail/span.inl @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_VOCABULARY_SPAN_INL -#define IOX_DUST_VOCABULARY_SPAN_INL + +#ifndef IOX_HOOFS_VOCABULARY_SPAN_INL +#define IOX_HOOFS_VOCABULARY_SPAN_INL #include "iox/span.hpp" @@ -271,4 +272,4 @@ inline span as_ } } // namespace iox -#endif // IOX_DUST_VOCABULARY_SPAN_INL +#endif // IOX_HOOFS_VOCABULARY_SPAN_INL diff --git a/iceoryx_dust/vocabulary/include/iox/detail/span_iterator.hpp b/iceoryx_hoofs/vocabulary/include/iox/detail/span_iterator.hpp similarity index 95% rename from iceoryx_dust/vocabulary/include/iox/detail/span_iterator.hpp rename to iceoryx_hoofs/vocabulary/include/iox/detail/span_iterator.hpp index 91ce86631e..870d502395 100644 --- a/iceoryx_dust/vocabulary/include/iox/detail/span_iterator.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/detail/span_iterator.hpp @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_VOCABULARY_SPAN_ITERATOR_HPP -#define IOX_DUST_VOCABULARY_SPAN_ITERATOR_HPP + +#ifndef IOX_HOOFS_VOCABULARY_SPAN_ITERATOR_HPP +#define IOX_HOOFS_VOCABULARY_SPAN_ITERATOR_HPP // Use 'assert's as 'IOX_EXPECTS' is not useable inside 'constexpr' functions #include @@ -109,6 +110,8 @@ class span_iterator final return *this; } assert(m_begin && m_current && m_end); + // NOLINTJUSTIFICATION false positive + // NOLINTNEXTLINE(bugprone-branch-clone) if (n > 0) { assert(m_end - m_current >= n); @@ -141,6 +144,8 @@ class span_iterator final return *this; } assert(m_begin && m_current && m_end); + // NOLINTJUSTIFICATION false positive + // NOLINTNEXTLINE(bugprone-branch-clone) if (n > 0) { assert(m_current - m_begin >= n); @@ -213,10 +218,7 @@ class span_iterator final const pointer m_begin{nullptr}; const pointer m_end{nullptr}; pointer m_current{nullptr}; - - template - friend struct std::pointer_traits; }; } // namespace iox -#endif // IOX_DUST_VOCABULARY_SPAN_ITERATOR_HPP +#endif // IOX_HOOFS_VOCABULARY_SPAN_ITERATOR_HPP diff --git a/iceoryx_dust/vocabulary/include/iox/span.hpp b/iceoryx_hoofs/vocabulary/include/iox/span.hpp similarity index 99% rename from iceoryx_dust/vocabulary/include/iox/span.hpp rename to iceoryx_hoofs/vocabulary/include/iox/span.hpp index 18a1ee9d2f..69dc0c5e85 100644 --- a/iceoryx_dust/vocabulary/include/iox/span.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/span.hpp @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_VOCABULARY_SPAN_HPP -#define IOX_DUST_VOCABULARY_SPAN_HPP + +#ifndef IOX_HOOFS_VOCABULARY_SPAN_HPP +#define IOX_HOOFS_VOCABULARY_SPAN_HPP #include "iceoryx_hoofs/cxx/requires.hpp" #include "iox/detail/span_iterator.hpp" @@ -412,4 +413,4 @@ span as_writabl #include "iox/detail/span.inl" -#endif // IOX_DUST_VOCABULARY_SPAN_HPP +#endif // IOX_HOOFS_VOCABULARY_SPAN_HPP From d5eaa650aa576d94b859e1745220c3cd9863eb63 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 00:57:22 +0100 Subject: [PATCH 02/18] iox-#2130 Update README --- iceoryx_dust/README.md | 1 - iceoryx_hoofs/README.md | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iceoryx_dust/README.md b/iceoryx_dust/README.md index 7614d09b0d..265fba2562 100644 --- a/iceoryx_dust/README.md +++ b/iceoryx_dust/README.md @@ -17,5 +17,4 @@ grouped together in categories or namespace, depending on where or how they are |`NamedPipe` | Shared memory based IPC channel. Mainly a `UnixDomainSocket` replacement on Windows. | |`relocatable_ptr` | | |`static_storage` | Untyped aligned static storage. | -|`convert` | Converting a number into a string is easy, converting it back can be hard. You can use functions like `strtoll`, but you still have to handle errors like under- and overflow, or converting invalid strings into number. Here we abstract all the error handling so that you can convert strings into numbers safely. | |`serialization` | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index e7b3993d47..27f8a29ba8 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -47,11 +47,11 @@ The module structure is a logical grouping. It is replicated for `concurrent` an | class | internal | description | |:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`not_null` | | Runtime check wrapper to make sure a pointer is not `nullptr` | -|`optional` | | C++11 implementation of the C++17 feature `std::optional` | -|`variant` | | C++11 implementation of the C++17 feature `std::variant` | +|`optional` | | Implementation of `std::optional` | +|`variant` | | Implementation of `std::variant` | |`expected` | | Our base class used in error handling. Every function which can fail should return an expected. With this the user knows that this function can fail and that they have to do some kind of error handling. We got inspired by the [C++ expected proposal]( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0323r7.html) and by the [rust error handling concept](https://doc.rust-lang.org/std/result/enum.Result.html). | |`string` | | Heap and exception free implementation of `std::string`. Attention, since the string is stack based, std::string or char array which are assigned to this string will be truncated and zero-terminated if they exceed the string capacity. | -|`span` | | C++17 implementation of the C++20 feature `std::span` | +|`span` | | Implementation of `std::span` | ### Filesystem (filesystem) @@ -67,7 +67,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |:---------------------:|:--------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`storable_function` | i | A `std::function` alternative with configurable backend for memory storage. | |`function` | | A stack-based `std::function` replacement based on `storable_function` | -|`function_ref` | | C++11 implementation of the next-gen C++ feature `std::function_ref` see [function_ref proposal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0792r2.html). It behaves like `std::function` but does not own the callable. | +|`function_ref` | | Implementation of `std::function_ref` see [function_ref proposal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0792r2.html). It behaves like `std::function` but does not own the callable. | ### Utility (utility) @@ -75,6 +75,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |:---------------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`system_configuration` | i | Collection of free functions which acquire system information like the page-size. | |`UniqueId` | i | Monotonic increasing IDs within a process. | +|`convert` | i | Converting a number into a string is easy, converting it back can be hard. You can use functions like `strtoll`, but you still have to handle errors like under- and overflow, or converting invalid strings into number. Here we abstract all the error handling so that you can convert strings into numbers safely. | |`into` | i | | |`Scheduler` | i | Supported schedulers and functions to get their priority range are contained here. | @@ -139,7 +140,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`Builder` | | Macro which generates a setter method useful for a builder pattern. | |`IOX_POSIX_CALL` | | Wrapper around C and POSIX function calls which performs a full error handling. Additionally, this wrapper makes sure that `EINTR` handling is performed correctly by repeating the system call. | |`functional_interface` | | Constructs to easily add functional interfaces like `and_then` to object container. | -|`NewType` | | C++11 implementation of [Haskells NewType-pattern](https://wiki.haskell.org/Newtype). | +|`NewType` | | Implementation of [Haskells NewType-pattern](https://wiki.haskell.org/Newtype). | |`StaticLifetimeGuard` | | Static instance manager which solves the singleton lifetime problem. | |`PolymorphicHandler` | | Singleton handler with a default instance that can be changed at runtime. | From ba3942b9b68bba00239681199f7c5fda31034cf6 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 01:41:51 +0100 Subject: [PATCH 03/18] iox-#2130 Move 'container' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- iceoryx_dust/BUILD.bazel | 3 +-- iceoryx_dust/CMakeLists.txt | 2 -- iceoryx_dust/README.md | 2 -- iceoryx_hoofs/README.md | 2 ++ .../iox/detail/fixed_position_container.inl | 16 ++++++------ .../include/iox/detail/forward_list.inl | 6 ++--- .../include/iox/fixed_position_container.hpp | 6 ++--- .../container/include/iox/forward_list.hpp | 6 ++--- ...est_container_fixed_position_container.cpp | 25 +++++++++++-------- .../test_container_forward_list.cpp | 2 +- 10 files changed, 36 insertions(+), 34 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/container/include/iox/detail/fixed_position_container.inl (97%) rename {iceoryx_dust => iceoryx_hoofs}/container/include/iox/detail/forward_list.inl (99%) rename {iceoryx_dust => iceoryx_hoofs}/container/include/iox/fixed_position_container.hpp (98%) rename {iceoryx_dust => iceoryx_hoofs}/container/include/iox/forward_list.hpp (99%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_container_fixed_position_container.cpp (99%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_container_forward_list.cpp (99%) diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel index 2362c63694..c686d45001 100644 --- a/iceoryx_dust/BUILD.bazel +++ b/iceoryx_dust/BUILD.bazel @@ -35,12 +35,11 @@ cc_library( "posix/ipc/source/**/*.cpp", "posix/sync/source/**/*.cpp", ]), - hdrs = glob(["cli/**"]) + glob(["container/**"]) + glob(["filesystem/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ + hdrs = glob(["cli/**"]) + glob(["filesystem/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ ":iceoryx_dust_deployment_hpp", ], includes = [ "cli/include/", - "container/include/", "filesystem/include/", "generated/include/", "memory/include/", diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index 9bbba355f8..a7612053fd 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -47,7 +47,6 @@ iox_add_library( PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/cli/include - ${PROJECT_SOURCE_DIR}/container/include ${PROJECT_SOURCE_DIR}/filesystem/include ${PROJECT_SOURCE_DIR}/memory/include ${PROJECT_SOURCE_DIR}/posix/ipc/include @@ -56,7 +55,6 @@ iox_add_library( ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS cli/include/ - container/include/ filesystem/include/ memory/include/ posix/ipc/include/ diff --git a/iceoryx_dust/README.md b/iceoryx_dust/README.md index 265fba2562..c05e743e52 100644 --- a/iceoryx_dust/README.md +++ b/iceoryx_dust/README.md @@ -9,9 +9,7 @@ grouped together in categories or namespace, depending on where or how they are | class/file | description | |:---------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|`forward_list` | Heap and exception free, relocatable implementation of `std::forward_list` | |`FileReader` | Wrapper for opening files and reading them. | -|`FixedPositionContainer` | A fixed-position container is similar to a list but is optimized for iterating over its elements without the back-and-forth jumping that can occur during iteration in a list. | |`MessageQueue` | Interface for Message Queues, see [ManPage mq_overview](https://www.man7.org/linux/man-pages/man7/mq_overview.7.html). | |`SignalWatcher` | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | |`NamedPipe` | Shared memory based IPC channel. Mainly a `UnixDomainSocket` replacement on Windows. | diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 27f8a29ba8..08c5133211 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -39,7 +39,9 @@ The module structure is a logical grouping. It is replicated for `concurrent` an | class | internal | description | |:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`vector` | | Heap and exception free implementation of `std::vector` | +|`forward_list` | | Heap and exception free, relocatable implementation of `std::forward_list` | |`list` | | Heap and exception free, relocatable implementation of `std::list` | +|`FixedPositionContainer` | | A fixed-position container is similar to a list but is optimized for iterating over its elements without the back-and-forth jumping that can occur during iteration in a list. | |`UninitializedArray` | | Wrapper class for an uninitialized C-style array which can be zeroed via a template parameter | ### Vocabulary types (vocabulary) diff --git a/iceoryx_dust/container/include/iox/detail/fixed_position_container.inl b/iceoryx_hoofs/container/include/iox/detail/fixed_position_container.inl similarity index 97% rename from iceoryx_dust/container/include/iox/detail/fixed_position_container.inl rename to iceoryx_hoofs/container/include/iox/detail/fixed_position_container.inl index a7a2f50c61..ab96c99d7d 100644 --- a/iceoryx_dust/container/include/iox/detail/fixed_position_container.inl +++ b/iceoryx_hoofs/container/include/iox/detail/fixed_position_container.inl @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL -#define IOX_DUST_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL +#ifndef IOX_HOOFS_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL +#define IOX_HOOFS_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL #include "iox/fixed_position_container.hpp" @@ -30,7 +30,7 @@ inline FixedPositionContainer::FixedPositionContainer() noexcept { m_status[i] = SlotStatus::FREE; - IndexType next = static_cast(i + 1U); + auto next = static_cast(i + 1U); m_next[i] = next; i = next; } @@ -137,7 +137,7 @@ inline void FixedPositionContainer::copy_and_move_impl(RhsType&& rh m_status[i] = SlotStatus::FREE; - IndexType next = static_cast(i + 1U); + auto next = static_cast(i + 1U); m_next[i] = next; } @@ -171,7 +171,7 @@ inline void FixedPositionContainer::clear() noexcept m_status[i] = SlotStatus::FREE; - IndexType next = static_cast(i + 1U); + auto next = static_cast(i + 1U); m_next[i] = next; i = next; } @@ -287,7 +287,7 @@ FixedPositionContainer::emplace(Targs&&... args) noexcept else { IOX_ENSURES_WITH_MSG(index != 0, "Corruption detected!"); - for (IndexType i = static_cast(index - 1U);; --i) + for (auto i = static_cast(index - 1U);; --i) { if (m_status[i] == SlotStatus::USED) { @@ -442,7 +442,7 @@ FixedPositionContainer::erase(const IndexType index) noexcept } IOX_ENSURES_WITH_MSG(index != 0, "Corruption detected! Index cannot be 0 at this location!"); - for (IndexType i = static_cast(index - 1U); !is_removed_from_used_list || !is_added_to_free_list; --i) + for (auto i = static_cast(index - 1U); !is_removed_from_used_list || !is_added_to_free_list; --i) { if (!is_removed_from_used_list && m_status[i] == SlotStatus::USED) { @@ -590,4 +590,4 @@ FixedPositionContainer::cend() const noexcept } } // namespace iox -#endif // IOX_DUST_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL +#endif // IOX_HOOFS_CONTAINER_DETAIL_FIXED_POSITION_CONTAINER_INL diff --git a/iceoryx_dust/container/include/iox/detail/forward_list.inl b/iceoryx_hoofs/container/include/iox/detail/forward_list.inl similarity index 99% rename from iceoryx_dust/container/include/iox/detail/forward_list.inl rename to iceoryx_hoofs/container/include/iox/detail/forward_list.inl index 1da79860ea..3a8bf26655 100644 --- a/iceoryx_dust/container/include/iox/detail/forward_list.inl +++ b/iceoryx_hoofs/container/include/iox/detail/forward_list.inl @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CONTAINER_FORWARD_LIST_INL -#define IOX_DUST_CONTAINER_FORWARD_LIST_INL +#ifndef IOX_HOOFS_CONTAINER_FORWARD_LIST_INL +#define IOX_HOOFS_CONTAINER_FORWARD_LIST_INL #include "iox/forward_list.hpp" @@ -610,4 +610,4 @@ inline bool forward_list::isInvalidIterOrDifferentLists(const const } // namespace iox -#endif // IOX_DUST_CONTAINER_FORWARD_LIST_INL +#endif // IOX_HOOFS_CONTAINER_FORWARD_LIST_INL diff --git a/iceoryx_dust/container/include/iox/fixed_position_container.hpp b/iceoryx_hoofs/container/include/iox/fixed_position_container.hpp similarity index 98% rename from iceoryx_dust/container/include/iox/fixed_position_container.hpp rename to iceoryx_hoofs/container/include/iox/fixed_position_container.hpp index 5f2473c163..c87426aa92 100644 --- a/iceoryx_dust/container/include/iox/fixed_position_container.hpp +++ b/iceoryx_hoofs/container/include/iox/fixed_position_container.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CONTAINER_FIXED_POSITION_CONTAINER_HPP -#define IOX_DUST_CONTAINER_FIXED_POSITION_CONTAINER_HPP +#ifndef IOX_HOOFS_CONTAINER_FIXED_POSITION_CONTAINER_HPP +#define IOX_HOOFS_CONTAINER_FIXED_POSITION_CONTAINER_HPP #include "iceoryx_hoofs/cxx/requires.hpp" #include "iox/algorithm.hpp" @@ -332,4 +332,4 @@ class FixedPositionContainer final #include "iox/detail/fixed_position_container.inl" -#endif // IOX_DUST_CONTAINER_FIXED_POSITION_CONTAINER_HPP +#endif // IOX_HOOFS_CONTAINER_FIXED_POSITION_CONTAINER_HPP diff --git a/iceoryx_dust/container/include/iox/forward_list.hpp b/iceoryx_hoofs/container/include/iox/forward_list.hpp similarity index 99% rename from iceoryx_dust/container/include/iox/forward_list.hpp rename to iceoryx_hoofs/container/include/iox/forward_list.hpp index 4628a6ce70..ea3485cf0e 100644 --- a/iceoryx_dust/container/include/iox/forward_list.hpp +++ b/iceoryx_hoofs/container/include/iox/forward_list.hpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CONTAINER_FORWARD_LIST_HPP -#define IOX_DUST_CONTAINER_FORWARD_LIST_HPP +#ifndef IOX_HOOFS_CONTAINER_FORWARD_LIST_HPP +#define IOX_HOOFS_CONTAINER_FORWARD_LIST_HPP #include "iceoryx_hoofs/cxx/requires.hpp" #include "iox/uninitialized_array.hpp" @@ -363,4 +363,4 @@ class forward_list #include "iox/detail/forward_list.inl" -#endif // IOX_DUST_CONTAINER_FORWARD_LIST_HPP +#endif // IOX_HOOFS_CONTAINER_FORWARD_LIST_HPP diff --git a/iceoryx_dust/test/moduletests/test_container_fixed_position_container.cpp b/iceoryx_hoofs/test/moduletests/test_container_fixed_position_container.cpp similarity index 99% rename from iceoryx_dust/test/moduletests/test_container_fixed_position_container.cpp rename to iceoryx_hoofs/test/moduletests/test_container_fixed_position_container.cpp index 4d6fa9d684..171ae5b402 100644 --- a/iceoryx_dust/test/moduletests/test_container_fixed_position_container.cpp +++ b/iceoryx_hoofs/test/moduletests/test_container_fixed_position_container.cpp @@ -35,7 +35,7 @@ class MovableButNonCopyableTestClass { public: // moveable only class requires this - MovableButNonCopyableTestClass(const T value) + explicit MovableButNonCopyableTestClass(const T value) : value(value) { } @@ -43,12 +43,12 @@ class MovableButNonCopyableTestClass MovableButNonCopyableTestClass(const MovableButNonCopyableTestClass& rhs) = delete; MovableButNonCopyableTestClass& operator=(const MovableButNonCopyableTestClass& rhs) = delete; - MovableButNonCopyableTestClass(MovableButNonCopyableTestClass&& rhs) + MovableButNonCopyableTestClass(MovableButNonCopyableTestClass&& rhs) noexcept + : value(rhs.value) { - value = rhs.value; } - MovableButNonCopyableTestClass& operator=(MovableButNonCopyableTestClass&& rhs) + MovableButNonCopyableTestClass& operator=(MovableButNonCopyableTestClass&& rhs) noexcept { if (this != &rhs) { @@ -93,7 +93,7 @@ struct FixedPositionContainer_test : public Test fillComplex(sut_complex); } - void fillComplex(SutComplex& s) + static void fillComplex(SutComplex& s) { for (DataType i = 0; i < CAPACITY; ++i) { @@ -487,7 +487,7 @@ TEST_F(FixedPositionContainer_test, UsingCopyAssignmentFromMultipleElementsConta std::vector EXPECTED_VALUE{56U, 57U, 58U, 59U}; constexpr uint64_t EXPECTED_SIZE{4U}; - for (SutComplex::IndexType i = 0; i < EXPECTED_VALUE.size(); ++i) + for (SutComplex::IndexType i = 0; i < EXPECTED_SIZE; ++i) { sut_complex.emplace(EXPECTED_VALUE[i]); } @@ -498,7 +498,7 @@ TEST_F(FixedPositionContainer_test, UsingCopyAssignmentFromMultipleElementsConta EXPECT_THAT(copy_sut_complex.full(), Eq(false)); EXPECT_THAT(copy_sut_complex.empty(), Eq(false)); EXPECT_THAT(copy_sut_complex.size(), Eq(sut_complex.size())); - for (SutComplex::IndexType i = 0; i < sut_complex.size(); ++i) + for (SutComplex::IndexType i = 0; i < EXPECTED_SIZE; ++i) { EXPECT_THAT(copy_sut_complex.iter_from_index(i)->value, Eq(EXPECTED_VALUE[i])); EXPECT_THAT(copy_sut_complex.iter_from_index(i), Ne(sut_complex.iter_from_index(i))); @@ -2310,11 +2310,14 @@ TEST_F(FixedPositionContainer_test, EraseWithPointerPointingOutOfContainerCallsE auto* ptr_first = sut.begin().to_ptr(); + // NOLINTJUSTIFICATION required for test + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) IOX_EXPECT_FATAL_FAILURE([&] { sut.erase(ptr_first - 1U); }, iox::HoofsError::EXPECTS_ENSURES_FAILED); IOX_EXPECT_FATAL_FAILURE([&] { sut.erase(ptr_first + CAPACITY); }, iox::HoofsError::EXPECTS_ENSURES_FAILED); + // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) } TEST_F(FixedPositionContainer_test, EraseWithUnalignedPointerCallsErrorHandler) @@ -2324,6 +2327,8 @@ TEST_F(FixedPositionContainer_test, EraseWithUnalignedPointerCallsErrorHandler) fillSut(); auto* ptr_first = sut.begin().to_ptr(); + // NOLINTJUSTIFICATION required for test + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast, performance-no-int-to-ptr) auto* ptr_unaligned = reinterpret_cast(reinterpret_cast(ptr_first) + 1U); IOX_EXPECT_FATAL_FAILURE([&] { sut.erase(ptr_unaligned); }, @@ -3122,10 +3127,10 @@ TEST_F(FixedPositionContainer_test, ToPtrOnEndIteratorCallsErrorHandler) { ::testing::Test::RecordProperty("TEST_ID", "51b76d04-6c8c-486e-88c9-8b6b760c41d4"); - IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = sut.end().to_ptr(); }, + IOX_EXPECT_FATAL_FAILURE([&] { auto* _ [[maybe_unused]] = sut.end().to_ptr(); }, iox::HoofsError::EXPECTS_ENSURES_FAILED); - IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = sut.cend().to_ptr(); }, + IOX_EXPECT_FATAL_FAILURE([&] { const auto* _ [[maybe_unused]] = sut.cend().to_ptr(); }, iox::HoofsError::EXPECTS_ENSURES_FAILED); } @@ -3136,7 +3141,7 @@ TEST_F(FixedPositionContainer_test, ToPtrOnInvalidIteratorCallsErrorHandler) auto it = sut.emplace(135U); sut.erase(it); - IOX_EXPECT_FATAL_FAILURE([&] { auto _ [[maybe_unused]] = it.to_ptr(); }, + IOX_EXPECT_FATAL_FAILURE([&] { auto* _ [[maybe_unused]] = it.to_ptr(); }, iox::HoofsError::EXPECTS_ENSURES_FAILED); } diff --git a/iceoryx_dust/test/moduletests/test_container_forward_list.cpp b/iceoryx_hoofs/test/moduletests/test_container_forward_list.cpp similarity index 99% rename from iceoryx_dust/test/moduletests/test_container_forward_list.cpp rename to iceoryx_hoofs/test/moduletests/test_container_forward_list.cpp index 7cc33d047a..68a65c807c 100644 --- a/iceoryx_dust/test/moduletests/test_container_forward_list.cpp +++ b/iceoryx_hoofs/test/moduletests/test_container_forward_list.cpp @@ -1152,7 +1152,7 @@ TEST_F(forward_list_test, IteratorTraitsGetValueType) TEST_F(forward_list_test, IteratorTraitsCheckIteratorCategoryOnConstIterator) { ::testing::Test::RecordProperty("TEST_ID", "ffbb06eb-5267-45e0-91e4-6172a27a3489"); - auto iter = sut.cbefore_begin(); + auto iter [[maybe_unused]] = sut.cbefore_begin(); ASSERT_NE(typeid(std::iterator_traits::iterator_category), typeid(std::random_access_iterator_tag)); EXPECT_EQ(typeid(std::iterator_traits::iterator_category), typeid(std::forward_iterator_tag)); } From ff5e7f25298b36033eb66649e4e2c2871736b663 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 01:55:36 +0100 Subject: [PATCH 04/18] iox-#2130 Scan all files in the 'container' module --- .clang-tidy-diff-scans.txt | 2 +- iceoryx_hoofs/container/include/iox/uninitialized_array.hpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-tidy-diff-scans.txt b/.clang-tidy-diff-scans.txt index f00aa318af..8f5e354077 100644 --- a/.clang-tidy-diff-scans.txt +++ b/.clang-tidy-diff-scans.txt @@ -26,7 +26,7 @@ ./iceoryx_hoofs/posix/**/* -./iceoryx_hoofs/container/include/iox/**/* +./iceoryx_hoofs/container/**/* ./iceoryx_hoofs/test/moduletests/test_container_* ./iceoryx_hoofs/vocabulary/**/* diff --git a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp index fb4db576b0..58e1862593 100644 --- a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp +++ b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp @@ -87,6 +87,7 @@ class UninitializedArray final // The (empty) user-defined constructor is required. // Use of "= default" leads to value-initialization of class members. // AXIVION Next Construct AutosarC++19_03-A12.6.1 : This is a low-level building block which is supposed to provide uninitialized memory + // NOLINTNEXTLINE(hicpp-use-equals-default) constexpr UninitializedArray() noexcept {}; UninitializedArray(const UninitializedArray&) = delete; UninitializedArray(UninitializedArray&&) = delete; From 08967a7398c8054580c87383d6f47f4c6c0fb537 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 02:08:45 +0100 Subject: [PATCH 05/18] iox-#2130 Move 'filesystem' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- iceoryx_dust/BUILD.bazel | 4 +--- iceoryx_dust/CMakeLists.txt | 3 --- iceoryx_hoofs/CMakeLists.txt | 1 + iceoryx_hoofs/README.md | 1 + .../filesystem/include/iox/file_reader.hpp | 6 +++--- .../filesystem/source/file_reader.cpp | 0 .../test/moduletests/test_filesystem_file_reader.cpp | 0 7 files changed, 6 insertions(+), 9 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/filesystem/include/iox/file_reader.hpp (94%) rename {iceoryx_dust => iceoryx_hoofs}/filesystem/source/file_reader.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_filesystem_file_reader.cpp (100%) diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel index c686d45001..a9856842a3 100644 --- a/iceoryx_dust/BUILD.bazel +++ b/iceoryx_dust/BUILD.bazel @@ -31,16 +31,14 @@ cc_library( name = "iceoryx_dust", srcs = glob([ "cli/source/**/*.cpp", - "filesystem/source/**/*.cpp", "posix/ipc/source/**/*.cpp", "posix/sync/source/**/*.cpp", ]), - hdrs = glob(["cli/**"]) + glob(["filesystem/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ + hdrs = glob(["cli/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ ":iceoryx_dust_deployment_hpp", ], includes = [ "cli/include/", - "filesystem/include/", "generated/include/", "memory/include/", "posix/ipc/include/", diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index a7612053fd..32fed56167 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -47,7 +47,6 @@ iox_add_library( PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/cli/include - ${PROJECT_SOURCE_DIR}/filesystem/include ${PROJECT_SOURCE_DIR}/memory/include ${PROJECT_SOURCE_DIR}/posix/ipc/include ${PROJECT_SOURCE_DIR}/posix/sync/include @@ -55,7 +54,6 @@ iox_add_library( ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS cli/include/ - filesystem/include/ memory/include/ posix/ipc/include/ posix/sync/include/ @@ -66,7 +64,6 @@ iox_add_library( cli/source/option.cpp cli/source/option_definition.cpp cli/source/option_manager.cpp - filesystem/source/file_reader.cpp posix/ipc/source/message_queue.cpp posix/ipc/source/named_pipe.cpp posix/sync/source/signal_watcher.cpp diff --git a/iceoryx_hoofs/CMakeLists.txt b/iceoryx_hoofs/CMakeLists.txt index 57cbbd268f..be826ce118 100644 --- a/iceoryx_hoofs/CMakeLists.txt +++ b/iceoryx_hoofs/CMakeLists.txt @@ -96,6 +96,7 @@ iox_add_library( posix/vocabulary/include/ FILES design/source/functional_interface.cpp + filesystem/source/file_reader.cpp filesystem/source/filesystem.cpp memory/source/bump_allocator.cpp memory/source/memory.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 08c5133211..1902279230 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -62,6 +62,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`filesystem` | | Implementation of C++17 filesystem features for instance `iox::access_rights` and `iox::perms` to abstract file permissions | |`PosixAcl` | i | Interface for Access Control Lists (ACL). | |`FileLock` | | File lock C++ wrapping class. | +|`FileReader` | Wrapper for opening files and reading them. | ### Functional (functional) diff --git a/iceoryx_dust/filesystem/include/iox/file_reader.hpp b/iceoryx_hoofs/filesystem/include/iox/file_reader.hpp similarity index 94% rename from iceoryx_dust/filesystem/include/iox/file_reader.hpp rename to iceoryx_hoofs/filesystem/include/iox/file_reader.hpp index b8018e9b19..18f1cd891a 100644 --- a/iceoryx_dust/filesystem/include/iox/file_reader.hpp +++ b/iceoryx_hoofs/filesystem/include/iox/file_reader.hpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_FILESYSTEM_FILE_READER_HPP -#define IOX_DUST_FILESYSTEM_FILE_READER_HPP +#ifndef IOX_HOOFS_FILESYSTEM_FILE_READER_HPP +#define IOX_HOOFS_FILESYSTEM_FILE_READER_HPP #include @@ -71,4 +71,4 @@ class FileReader } // namespace iox -#endif // IOX_DUST_FILESYSTEM_FILE_READER_HPP +#endif // IOX_HOOFS_FILESYSTEM_FILE_READER_HPP diff --git a/iceoryx_dust/filesystem/source/file_reader.cpp b/iceoryx_hoofs/filesystem/source/file_reader.cpp similarity index 100% rename from iceoryx_dust/filesystem/source/file_reader.cpp rename to iceoryx_hoofs/filesystem/source/file_reader.cpp diff --git a/iceoryx_dust/test/moduletests/test_filesystem_file_reader.cpp b/iceoryx_hoofs/test/moduletests/test_filesystem_file_reader.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_filesystem_file_reader.cpp rename to iceoryx_hoofs/test/moduletests/test_filesystem_file_reader.cpp From 4e6933758a00704d1fcf25e4ef43deae44e1cdde Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 03:16:22 +0100 Subject: [PATCH 06/18] iox-#2130 Move 'utility' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- .../test/moduletests/test_utility_serialization.cpp | 0 .../test/moduletests/test_utility_std_chrono_support.cpp | 0 .../test/moduletests/test_utility_std_string_support.cpp | 0 .../utility/include/iox/detail/serialization.hpp | 6 +++--- .../utility/include/iox/detail/serialization.inl | 8 ++++---- .../utility/include/iox/detail/std_chrono_support.inl | 6 +++--- .../utility/include/iox/detail/std_string_support.inl | 7 ++++--- .../utility/include/iox/std_chrono_support.hpp | 6 +++--- .../utility/include/iox/std_string_support.hpp | 6 +++--- 9 files changed, 20 insertions(+), 19 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_utility_serialization.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_utility_std_chrono_support.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_utility_std_string_support.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/detail/serialization.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/detail/serialization.inl (95%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/detail/std_chrono_support.inl (91%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/detail/std_string_support.inl (94%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/std_chrono_support.hpp (93%) rename {iceoryx_dust => iceoryx_hoofs}/utility/include/iox/std_string_support.hpp (93%) diff --git a/iceoryx_dust/test/moduletests/test_utility_serialization.cpp b/iceoryx_hoofs/test/moduletests/test_utility_serialization.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_utility_serialization.cpp rename to iceoryx_hoofs/test/moduletests/test_utility_serialization.cpp diff --git a/iceoryx_dust/test/moduletests/test_utility_std_chrono_support.cpp b/iceoryx_hoofs/test/moduletests/test_utility_std_chrono_support.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_utility_std_chrono_support.cpp rename to iceoryx_hoofs/test/moduletests/test_utility_std_chrono_support.cpp diff --git a/iceoryx_dust/test/moduletests/test_utility_std_string_support.cpp b/iceoryx_hoofs/test/moduletests/test_utility_std_string_support.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_utility_std_string_support.cpp rename to iceoryx_hoofs/test/moduletests/test_utility_std_string_support.cpp diff --git a/iceoryx_dust/utility/include/iox/detail/serialization.hpp b/iceoryx_hoofs/utility/include/iox/detail/serialization.hpp similarity index 97% rename from iceoryx_dust/utility/include/iox/detail/serialization.hpp rename to iceoryx_hoofs/utility/include/iox/detail/serialization.hpp index 66a0b1a914..4b05e2e18e 100644 --- a/iceoryx_dust/utility/include/iox/detail/serialization.hpp +++ b/iceoryx_hoofs/utility/include/iox/detail/serialization.hpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_SERIALIZATION_HPP -#define IOX_DUST_UTILITY_SERIALIZATION_HPP +#ifndef IOX_HOOFS_UTILITY_SERIALIZATION_HPP +#define IOX_HOOFS_UTILITY_SERIALIZATION_HPP #include "iox/detail/convert.hpp" #include "iox/std_string_support.hpp" @@ -141,4 +141,4 @@ class Serialization #include "iox/detail/serialization.inl" -#endif // IOX_DUST_UTILITY_SERIALIZATION_HPP +#endif // IOX_HOOFS_UTILITY_SERIALIZATION_HPP diff --git a/iceoryx_dust/utility/include/iox/detail/serialization.inl b/iceoryx_hoofs/utility/include/iox/detail/serialization.inl similarity index 95% rename from iceoryx_dust/utility/include/iox/detail/serialization.inl rename to iceoryx_hoofs/utility/include/iox/detail/serialization.inl index e1380f7c0f..bbee4acfc5 100644 --- a/iceoryx_dust/utility/include/iox/detail/serialization.inl +++ b/iceoryx_hoofs/utility/include/iox/detail/serialization.inl @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_SERIALIZATION_INL -#define IOX_DUST_UTILITY_SERIALIZATION_INL +#ifndef IOX_HOOFS_UTILITY_SERIALIZATION_INL +#define IOX_HOOFS_UTILITY_SERIALIZATION_INL #include "iox/detail/serialization.hpp" @@ -65,7 +65,7 @@ template inline typename std::enable_if::value, std::string>::type Serialization::getString(const T& t) noexcept { - Serialization serial = static_cast(t); + const auto serial = static_cast(t); return serial.toString(); } @@ -144,4 +144,4 @@ inline bool Serialization::getNth(const unsigned int index, T& t) const noexcept } } // namespace iox -#endif // IOX_DUST_CXX_SERIALIZATION_INL +#endif // IOX_HOOFS_UTILITY_SERIALIZATION_INL diff --git a/iceoryx_dust/utility/include/iox/detail/std_chrono_support.inl b/iceoryx_hoofs/utility/include/iox/detail/std_chrono_support.inl similarity index 91% rename from iceoryx_dust/utility/include/iox/detail/std_chrono_support.inl rename to iceoryx_hoofs/utility/include/iox/detail/std_chrono_support.inl index 8e6b46f9d5..0df0ee208b 100644 --- a/iceoryx_dust/utility/include/iox/detail/std_chrono_support.inl +++ b/iceoryx_hoofs/utility/include/iox/detail/std_chrono_support.inl @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_INL -#define IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_INL +#ifndef IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_INL +#define IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_INL #include "iox/std_chrono_support.hpp" @@ -47,4 +47,4 @@ FromImpl::fromImpl(const std::chrono::sec } // namespace iox -#endif // IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_INL +#endif // IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_INL diff --git a/iceoryx_dust/utility/include/iox/detail/std_string_support.inl b/iceoryx_hoofs/utility/include/iox/detail/std_string_support.inl similarity index 94% rename from iceoryx_dust/utility/include/iox/detail/std_string_support.inl rename to iceoryx_hoofs/utility/include/iox/detail/std_string_support.inl index 471550c21c..ea5c5aba5d 100644 --- a/iceoryx_dust/utility/include/iox/detail/std_string_support.inl +++ b/iceoryx_hoofs/utility/include/iox/detail/std_string_support.inl @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_STD_STRING_SUPPORT_INL -#define IOX_DUST_UTILITY_STD_STRING_SUPPORT_INL + +#ifndef IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_INL +#define IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_INL #include "iox/std_string_support.hpp" @@ -66,4 +67,4 @@ inline std::ostream& operator<<(std::ostream& stream, const string& st } } // namespace iox -#endif // IOX_DUST_UTILITY_STD_STRING_SUPPORT_INL +#endif // IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_INL diff --git a/iceoryx_dust/utility/include/iox/std_chrono_support.hpp b/iceoryx_hoofs/utility/include/iox/std_chrono_support.hpp similarity index 93% rename from iceoryx_dust/utility/include/iox/std_chrono_support.hpp rename to iceoryx_hoofs/utility/include/iox/std_chrono_support.hpp index 4669743bc0..750454642f 100644 --- a/iceoryx_dust/utility/include/iox/std_chrono_support.hpp +++ b/iceoryx_hoofs/utility/include/iox/std_chrono_support.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_HPP -#define IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_HPP +#ifndef IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_HPP +#define IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_HPP #include "iox/duration.hpp" #include "iox/into.hpp" @@ -63,4 +63,4 @@ struct FromImpl #include "iox/detail/std_chrono_support.inl" -#endif // IOX_DUST_UTILITY_STD_CHRONO_SUPPORT_HPP +#endif // IOX_HOOFS_UTILITY_STD_CHRONO_SUPPORT_HPP diff --git a/iceoryx_dust/utility/include/iox/std_string_support.hpp b/iceoryx_hoofs/utility/include/iox/std_string_support.hpp similarity index 93% rename from iceoryx_dust/utility/include/iox/std_string_support.hpp rename to iceoryx_hoofs/utility/include/iox/std_string_support.hpp index 73c459b299..28f1a89173 100644 --- a/iceoryx_dust/utility/include/iox/std_string_support.hpp +++ b/iceoryx_hoofs/utility/include/iox/std_string_support.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_UTILITY_STD_STRING_SUPPORT_HPP -#define IOX_DUST_UTILITY_STD_STRING_SUPPORT_HPP +#ifndef IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_HPP +#define IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_HPP #include "iox/into.hpp" #include "iox/optional.hpp" @@ -92,4 +92,4 @@ std::ostream& operator<<(std::ostream& stream, const string& str) noex #include "iox/detail/std_string_support.inl" -#endif // IOX_DUST_UTILITY_STD_STRING_SUPPORT_HPP +#endif // IOX_HOOFS_UTILITY_STD_STRING_SUPPORT_HPP From d63ec9d94820bbc9390bb295f44e9cf42374619b Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 03:43:30 +0100 Subject: [PATCH 07/18] iox-#2130 Move 'memory' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- .../include/iox/detail/relocatable_ptr.inl | 6 +++--- .../memory/include/iox/detail/static_storage.hpp | 6 +++--- .../memory/include/iox/detail/static_storage.inl | 6 +++--- .../memory/include/iox/relocatable_ptr.hpp | 6 +++--- .../moduletests/test_memory_relocatable_ptr.cpp | 16 ++++++++++++---- .../moduletests/test_memory_static_storage.cpp | 0 6 files changed, 24 insertions(+), 16 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/memory/include/iox/detail/relocatable_ptr.inl (96%) rename {iceoryx_dust => iceoryx_hoofs}/memory/include/iox/detail/static_storage.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/memory/include/iox/detail/static_storage.inl (96%) rename {iceoryx_dust => iceoryx_hoofs}/memory/include/iox/relocatable_ptr.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_memory_relocatable_ptr.cpp (93%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_memory_static_storage.cpp (100%) diff --git a/iceoryx_dust/memory/include/iox/detail/relocatable_ptr.inl b/iceoryx_hoofs/memory/include/iox/detail/relocatable_ptr.inl similarity index 96% rename from iceoryx_dust/memory/include/iox/detail/relocatable_ptr.inl rename to iceoryx_hoofs/memory/include/iox/detail/relocatable_ptr.inl index a234b3583e..6dc2314860 100644 --- a/iceoryx_dust/memory/include/iox/detail/relocatable_ptr.inl +++ b/iceoryx_hoofs/memory/include/iox/detail/relocatable_ptr.inl @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_MEMORY_RELOCATABLE_PTR_INL -#define IOX_DUST_MEMORY_RELOCATABLE_PTR_INL +#ifndef IOX_HOOFS_MEMORY_RELOCATABLE_PTR_INL +#define IOX_HOOFS_MEMORY_RELOCATABLE_PTR_INL #include "iox/relocatable_ptr.hpp" @@ -161,4 +161,4 @@ inline bool operator!=(const relocatable_ptr& lhs, const relocatable_ptr& } // namespace iox -#endif // IOX_DUST_MEMORY_RELOCATABLE_PTR_INL +#endif // IOX_HOOFS_MEMORY_RELOCATABLE_PTR_INL diff --git a/iceoryx_dust/memory/include/iox/detail/static_storage.hpp b/iceoryx_hoofs/memory/include/iox/detail/static_storage.hpp similarity index 97% rename from iceoryx_dust/memory/include/iox/detail/static_storage.hpp rename to iceoryx_hoofs/memory/include/iox/detail/static_storage.hpp index 46e097356c..24d795ab32 100644 --- a/iceoryx_dust/memory/include/iox/detail/static_storage.hpp +++ b/iceoryx_hoofs/memory/include/iox/detail/static_storage.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_MEMORY_STATIC_STORAGE_HPP -#define IOX_DUST_MEMORY_STATIC_STORAGE_HPP +#ifndef IOX_HOOFS_MEMORY_STATIC_STORAGE_HPP +#define IOX_HOOFS_MEMORY_STATIC_STORAGE_HPP #include #include @@ -107,4 +107,4 @@ class static_storage final } // namespace iox #include "iox/detail/static_storage.inl" -#endif // IOX_DUST_MEMORY_STATIC_STORAGE_HPP +#endif // IOX_HOOFS_MEMORY_STATIC_STORAGE_HPP diff --git a/iceoryx_dust/memory/include/iox/detail/static_storage.inl b/iceoryx_hoofs/memory/include/iox/detail/static_storage.inl similarity index 96% rename from iceoryx_dust/memory/include/iox/detail/static_storage.inl rename to iceoryx_hoofs/memory/include/iox/detail/static_storage.inl index 39d9e362b0..d1b2693d04 100644 --- a/iceoryx_dust/memory/include/iox/detail/static_storage.inl +++ b/iceoryx_hoofs/memory/include/iox/detail/static_storage.inl @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_MEMORY_STATIC_STORAGE_INL -#define IOX_DUST_MEMORY_STATIC_STORAGE_INL +#ifndef IOX_HOOFS_MEMORY_STATIC_STORAGE_INL +#define IOX_HOOFS_MEMORY_STATIC_STORAGE_INL #include "iox/detail/static_storage.hpp" @@ -110,4 +110,4 @@ constexpr uint64_t static_storage::allocation_size() noexcept } // namespace iox -#endif // IOX_DUST_MEMORY_STATIC_STORAGE_INL +#endif // IOX_HOOFS_MEMORY_STATIC_STORAGE_INL diff --git a/iceoryx_dust/memory/include/iox/relocatable_ptr.hpp b/iceoryx_hoofs/memory/include/iox/relocatable_ptr.hpp similarity index 97% rename from iceoryx_dust/memory/include/iox/relocatable_ptr.hpp rename to iceoryx_hoofs/memory/include/iox/relocatable_ptr.hpp index 60d61ab700..37db9a9d76 100644 --- a/iceoryx_dust/memory/include/iox/relocatable_ptr.hpp +++ b/iceoryx_hoofs/memory/include/iox/relocatable_ptr.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_MEMORY_RELOCATABLE_PTR_HPP -#define IOX_DUST_MEMORY_RELOCATABLE_PTR_HPP +#ifndef IOX_HOOFS_MEMORY_RELOCATABLE_PTR_HPP +#define IOX_HOOFS_MEMORY_RELOCATABLE_PTR_HPP #include #include @@ -150,4 +150,4 @@ bool operator!=(const relocatable_ptr& lhs, const relocatable_ptr& rhs) no #include "iox/detail/relocatable_ptr.inl" -#endif // IOX_DUST_MEMORY_RELOCATABLE_PTR_HPP +#endif // IOX_HOOFS_MEMORY_RELOCATABLE_PTR_HPP diff --git a/iceoryx_dust/test/moduletests/test_memory_relocatable_ptr.cpp b/iceoryx_hoofs/test/moduletests/test_memory_relocatable_ptr.cpp similarity index 93% rename from iceoryx_dust/test/moduletests/test_memory_relocatable_ptr.cpp rename to iceoryx_hoofs/test/moduletests/test_memory_relocatable_ptr.cpp index 7d8028e195..4e3f768b69 100644 --- a/iceoryx_dust/test/moduletests/test_memory_relocatable_ptr.cpp +++ b/iceoryx_hoofs/test/moduletests/test_memory_relocatable_ptr.cpp @@ -36,14 +36,14 @@ inline T* nonNullPtr() } template <> -inline void* nonNullPtr() +[[maybe_unused]] inline void* nonNullPtr() { static int t; return &t; } template <> -inline const void* nonNullPtr() +[[maybe_unused]] inline const void* nonNullPtr() { static int t; return &t; @@ -57,14 +57,14 @@ inline T* otherNonNullPtr() } template <> -inline void* otherNonNullPtr() +[[maybe_unused]] inline void* otherNonNullPtr() { static int t; return &t; } template <> -inline const void* otherNonNullPtr() +[[maybe_unused]] inline const void* otherNonNullPtr() { static int t; return &t; @@ -208,6 +208,8 @@ TYPED_TEST(Relocatable_ptr_typed_test, moveCtorOfNullptrWorks) using T = typename TestFixture::DataType; relocatable_ptr rp1; relocatable_ptr rp2(std::move(rp1)); + // NOLINTJUSTIFICATION we explicitly want to test the defined state of a moved pointer + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved,clang-analyzer-cplusplus.Move) EXPECT_EQ(rp1.get(), nullptr); EXPECT_EQ(rp2.get(), nullptr); } @@ -234,6 +236,8 @@ TYPED_TEST(Relocatable_ptr_typed_test, moveAssignmentOfNullptrWorks) relocatable_ptr rp1; relocatable_ptr rp2(p); rp2 = std::move(rp1); + // NOLINTJUSTIFICATION we explicitly want to test the defined state of a moved pointer + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved,clang-analyzer-cplusplus.Move) EXPECT_EQ(rp1.get(), nullptr); EXPECT_EQ(rp2.get(), nullptr); } @@ -265,6 +269,8 @@ TYPED_TEST(Relocatable_ptr_typed_test, moveCtorWorks) T* p = nonNullPtr(); relocatable_ptr rp1(p); relocatable_ptr rp2(std::move(rp1)); + // NOLINTJUSTIFICATION we explicitly want to test the defined state of a moved pointer + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved,clang-analyzer-cplusplus.Move) EXPECT_EQ(rp1.get(), nullptr); EXPECT_EQ(rp2.get(), p); } @@ -289,6 +295,8 @@ TYPED_TEST(Relocatable_ptr_typed_test, moveAssignmentWorks) relocatable_ptr rp1(p); relocatable_ptr rp2; rp2 = std::move(rp1); + // NOLINTJUSTIFICATION we explicitly want to test the defined state of a moved pointer + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved,clang-analyzer-cplusplus.Move) EXPECT_EQ(rp1.get(), nullptr); EXPECT_EQ(rp2.get(), p); } diff --git a/iceoryx_dust/test/moduletests/test_memory_static_storage.cpp b/iceoryx_hoofs/test/moduletests/test_memory_static_storage.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_memory_static_storage.cpp rename to iceoryx_hoofs/test/moduletests/test_memory_static_storage.cpp From 28908d62931c3b4c39a3cceef98ca5db5d9b639d Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 03:54:44 +0100 Subject: [PATCH 08/18] iox-#2130 Move 'ipc' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- iceoryx_dust/BUILD.bazel | 2 - iceoryx_dust/CMakeLists.txt | 24 ----------- iceoryx_dust/README.md | 4 -- .../cmake/IceoryxDustDeployment.cmake | 43 ------------------- .../cmake/iceoryx_dust_deployment.hpp.in | 32 -------------- iceoryx_hoofs/CMakeLists.txt | 2 + iceoryx_hoofs/README.md | 4 ++ .../cmake/IceoryxHoofsDeployment.cmake | 27 ++++++++++-- .../cmake/iceoryx_hoofs_deployment.hpp.in | 3 ++ .../posix/ipc/include/iox/message_queue.hpp | 6 +-- .../posix/ipc/include/iox/named_pipe.hpp | 8 ++-- .../posix/ipc/source/message_queue.cpp | 4 +- .../posix/ipc/source/named_pipe.cpp | 6 ++- 13 files changed, 45 insertions(+), 120 deletions(-) delete mode 100644 iceoryx_dust/cmake/IceoryxDustDeployment.cmake delete mode 100644 iceoryx_dust/cmake/iceoryx_dust_deployment.hpp.in rename {iceoryx_dust => iceoryx_hoofs}/posix/ipc/include/iox/message_queue.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/posix/ipc/include/iox/named_pipe.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/posix/ipc/source/message_queue.cpp (99%) rename {iceoryx_dust => iceoryx_hoofs}/posix/ipc/source/named_pipe.cpp (97%) diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel index a9856842a3..6a8496a190 100644 --- a/iceoryx_dust/BUILD.bazel +++ b/iceoryx_dust/BUILD.bazel @@ -31,7 +31,6 @@ cc_library( name = "iceoryx_dust", srcs = glob([ "cli/source/**/*.cpp", - "posix/ipc/source/**/*.cpp", "posix/sync/source/**/*.cpp", ]), hdrs = glob(["cli/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ @@ -41,7 +40,6 @@ cc_library( "cli/include/", "generated/include/", "memory/include/", - "posix/ipc/include/", "posix/sync/include/", "utility/include/", ], diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index 32fed56167..8579516795 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -27,8 +27,6 @@ include(IceoryxPackageHelper) include(IceoryxPlatform) include(IceoryxPlatformSettings) -include(cmake/IceoryxDustDeployment.cmake) - if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin) option(BUILD_SHARED_LIBS "Create shared libraries by default" ON) endif() @@ -47,15 +45,11 @@ iox_add_library( PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/cli/include - ${PROJECT_SOURCE_DIR}/memory/include - ${PROJECT_SOURCE_DIR}/posix/ipc/include ${PROJECT_SOURCE_DIR}/posix/sync/include ${PROJECT_SOURCE_DIR}/utility/include ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS cli/include/ - memory/include/ - posix/ipc/include/ posix/sync/include/ utility/include/ FILES @@ -64,27 +58,9 @@ iox_add_library( cli/source/option.cpp cli/source/option_definition.cpp cli/source/option_manager.cpp - posix/ipc/source/message_queue.cpp - posix/ipc/source/named_pipe.cpp posix/sync/source/signal_watcher.cpp ) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/iceoryx_dust_deployment.hpp.in" - "${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include/iox/iceoryx_dust_deployment.hpp" @ONLY) - -install( - FILES ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include/iox/iceoryx_dust_deployment.hpp - DESTINATION include/${PREFIX}/iox/ - COMPONENT dev -) - -# install deployment file to make posh config accessible by other packages -install( - FILES - cmake/IceoryxDustDeployment.cmake - DESTINATION ${DESTINATION_CONFIGDIR} -) - # ########## dust testing ########## # diff --git a/iceoryx_dust/README.md b/iceoryx_dust/README.md index c05e743e52..114a9dce3b 100644 --- a/iceoryx_dust/README.md +++ b/iceoryx_dust/README.md @@ -10,9 +10,5 @@ grouped together in categories or namespace, depending on where or how they are | class/file | description | |:---------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`FileReader` | Wrapper for opening files and reading them. | -|`MessageQueue` | Interface for Message Queues, see [ManPage mq_overview](https://www.man7.org/linux/man-pages/man7/mq_overview.7.html). | |`SignalWatcher` | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | -|`NamedPipe` | Shared memory based IPC channel. Mainly a `UnixDomainSocket` replacement on Windows. | -|`relocatable_ptr` | | -|`static_storage` | Untyped aligned static storage. | |`serialization` | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | diff --git a/iceoryx_dust/cmake/IceoryxDustDeployment.cmake b/iceoryx_dust/cmake/IceoryxDustDeployment.cmake deleted file mode 100644 index 405c845a0f..0000000000 --- a/iceoryx_dust/cmake/IceoryxDustDeployment.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. -# Copyright (c) 2021 by Apex.AI Inc. All rights reserved. -# Copyright (c) 2023 by NXP. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# define macro for option configuration -macro(configure_option) - set(ONE_VALUE_ARGS NAME DEFAULT_VALUE) - cmake_parse_arguments(CONFIGURE_OPTION "" "${ONE_VALUE_ARGS}" "" ${ARGN}) - - if(NOT ${CONFIGURE_OPTION_NAME}) - set(${CONFIGURE_OPTION_NAME} ${CONFIGURE_OPTION_DEFAULT_VALUE}) - endif() - message(STATUS "[i] ${CONFIGURE_OPTION_NAME}: " ${${CONFIGURE_OPTION_NAME}}) -endmacro() - -# configure deployment -message(STATUS "[i] <<<<<<<<<<<<< Start iceoryx_dust configuration: >>>>>>>>>>>>>") - -configure_option( - NAME IOX_MAX_NAMED_PIPE_MESSAGE_SIZE - DEFAULT_VALUE 4096 -) -configure_option( - NAME IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES - DEFAULT_VALUE 10 -) - -message(STATUS "[i] <<<<<<<<<<<<<< End iceoryx_dust configuration: >>>>>>>>>>>>>>") - diff --git a/iceoryx_dust/cmake/iceoryx_dust_deployment.hpp.in b/iceoryx_dust/cmake/iceoryx_dust_deployment.hpp.in deleted file mode 100644 index 96b559ee11..0000000000 --- a/iceoryx_dust/cmake/iceoryx_dust_deployment.hpp.in +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2023 by NXP. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_POSH_ICEORYX_DUST_DEPLOYMENT_HPP -#define IOX_POSH_ICEORYX_DUST_DEPLOYMENT_HPP - -#include - -namespace iox -{ -namespace build -{ -constexpr uint64_t IOX_MAX_NAMED_PIPE_MESSAGE_SIZE = static_cast(@IOX_MAX_NAMED_PIPE_MESSAGE_SIZE@); -constexpr uint32_t IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES = - static_cast(@IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES@); -} // namespace build -} // namespace iox - -#endif // IOX_POSH_ICEORYX_DUST_DEPLOYMENT_HPP diff --git a/iceoryx_hoofs/CMakeLists.txt b/iceoryx_hoofs/CMakeLists.txt index be826ce118..664c8405d6 100644 --- a/iceoryx_hoofs/CMakeLists.txt +++ b/iceoryx_hoofs/CMakeLists.txt @@ -115,6 +115,8 @@ iox_add_library( posix/auth/source/posix_group.cpp posix/auth/source/posix_user.cpp posix/design/source/file_management_interface.cpp + posix/ipc/source/message_queue.cpp + posix/ipc/source/named_pipe.cpp posix/ipc/source/posix_memory_map.cpp posix/ipc/source/posix_shared_memory.cpp posix/ipc/source/posix_shared_memory_object.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 1902279230..266a9e980a 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -30,6 +30,8 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |:----------------------------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`unique_ptr` | | Provides a heap-less unique_ptr implementation, unlike the STL | |`RelativePointer` | | Pointer which can be stored in shared memory | +|`relocatable_ptr` | | | +|`static_storage` | i | Untyped aligned static storage. | |`ScopeGuard` | | This is an abstraction of the C++ RAII idiom. Sometimes you have constructs where you would like to perform a certain task on creation and then again when they are getting out of scope, this is where `ScopeGuard` comes in. It is like a `std::lock_guard` or a `std::shared_ptr` but more generic. | |`scoped_static` | | Helper function to limit lifetime of static or global variables to a scope | |`BumpAllocator` | | Implementation of a bump allocator | @@ -120,6 +122,8 @@ The module structure is a logical grouping. It is replicated for `concurrent` an | class | internal | description | |:----------------------------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`UnixDomainSocket` | | Interface for unix domain sockets. | +|`MessageQueue` | Interface for Message Queues, see [ManPage mq_overview](https://www.man7.org/linux/man-pages/man7/mq_overview.7.html). | +|`NamedPipe` | Shared memory based IPC channel. Mainly a `UnixDomainSocket` replacement on Windows. | |`PosixSharedMemoryObject` | | Creates and maps existing shared memory into the application. | |`PosixMemoryMap` | i | Abstraction of `mmap`, `munmap` and helper class for the `PosixSharedMemoryObject`. | |`PosixSharedMemory` | i | Abstraction of shared memory, see [ManPage shm_overview](https://www.man7.org/linux/man-pages/man7/shm_overview.7.html) and helper class for the `PosixSharedMemoryObject`. | diff --git a/iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake b/iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake index 7185328cd1..725855cc0e 100644 --- a/iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake +++ b/iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake @@ -14,11 +14,30 @@ # # SPDX-License-Identifier: Apache-2.0 +# define macro for option configuration +macro(configure_option) + set(ONE_VALUE_ARGS NAME DEFAULT_VALUE) + cmake_parse_arguments(CONFIGURE_OPTION "" "${ONE_VALUE_ARGS}" "" ${ARGN}) + + if(NOT ${CONFIGURE_OPTION_NAME}) + set(${CONFIGURE_OPTION_NAME} ${CONFIGURE_OPTION_DEFAULT_VALUE}) + endif() + message(STATUS "[i] ${CONFIGURE_OPTION_NAME}: " ${${CONFIGURE_OPTION_NAME}}) +endmacro() + message(STATUS "[i] <<<<<<<<<<<<< Start iceoryx_hoofs configuration: >>>>>>>>>>>>>") -if(NOT DEFINED IOX_MINIMAL_LOG_LEVEL) - set(IOX_MINIMAL_LOG_LEVEL "TRACE") -endif() -message(STATUS "[i] IOX_MINIMAL_LOG_LEVEL: " ${IOX_MINIMAL_LOG_LEVEL}) +configure_option( + NAME IOX_MINIMAL_LOG_LEVEL + DEFAULT_VALUE "TRACE" +) +configure_option( + NAME IOX_MAX_NAMED_PIPE_MESSAGE_SIZE + DEFAULT_VALUE 4096 +) +configure_option( + NAME IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES + DEFAULT_VALUE 10 +) message(STATUS "[i] <<<<<<<<<<<<<< End iceoryx_hoofs configuration: >>>>>>>>>>>>>>") diff --git a/iceoryx_hoofs/cmake/iceoryx_hoofs_deployment.hpp.in b/iceoryx_hoofs/cmake/iceoryx_hoofs_deployment.hpp.in index fe0b419757..218db9b65a 100644 --- a/iceoryx_hoofs/cmake/iceoryx_hoofs_deployment.hpp.in +++ b/iceoryx_hoofs/cmake/iceoryx_hoofs_deployment.hpp.in @@ -32,6 +32,9 @@ namespace build constexpr iox::log::LogLevel IOX_MINIMAL_LOG_LEVEL = iox::log::LogLevel::@IOX_MINIMAL_LOG_LEVEL@; +constexpr uint64_t IOX_MAX_NAMED_PIPE_MESSAGE_SIZE = static_cast(@IOX_MAX_NAMED_PIPE_MESSAGE_SIZE@); +constexpr uint32_t IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES = static_cast(@IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES@); + } // namespace build } // namespace iox diff --git a/iceoryx_dust/posix/ipc/include/iox/message_queue.hpp b/iceoryx_hoofs/posix/ipc/include/iox/message_queue.hpp similarity index 97% rename from iceoryx_dust/posix/ipc/include/iox/message_queue.hpp rename to iceoryx_hoofs/posix/ipc/include/iox/message_queue.hpp index 2b624bb75d..6717e7978b 100644 --- a/iceoryx_dust/posix/ipc/include/iox/message_queue.hpp +++ b/iceoryx_hoofs/posix/ipc/include/iox/message_queue.hpp @@ -16,8 +16,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_POSIX_IPC_MESSAGE_QUEUE_HPP -#define IOX_DUST_POSIX_IPC_MESSAGE_QUEUE_HPP +#ifndef IOX_HOOFS_POSIX_IPC_MESSAGE_QUEUE_HPP +#define IOX_HOOFS_POSIX_IPC_MESSAGE_QUEUE_HPP #include "iceoryx_platform/fcntl.hpp" #include "iceoryx_platform/mqueue.hpp" @@ -149,4 +149,4 @@ class MessageQueueBuilder } // namespace iox -#endif // IOX_DUST_POSIX_IPC_MESSAGE_QUEUE_HPP +#endif // IOX_HOOFS_POSIX_IPC_MESSAGE_QUEUE_HPP diff --git a/iceoryx_dust/posix/ipc/include/iox/named_pipe.hpp b/iceoryx_hoofs/posix/ipc/include/iox/named_pipe.hpp similarity index 97% rename from iceoryx_dust/posix/ipc/include/iox/named_pipe.hpp rename to iceoryx_hoofs/posix/ipc/include/iox/named_pipe.hpp index 4c55e86334..73071840fc 100644 --- a/iceoryx_dust/posix/ipc/include/iox/named_pipe.hpp +++ b/iceoryx_hoofs/posix/ipc/include/iox/named_pipe.hpp @@ -15,15 +15,15 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_POSIX_IPC_NAMED_PIPE_HPP -#define IOX_DUST_POSIX_IPC_NAMED_PIPE_HPP +#ifndef IOX_HOOFS_POSIX_IPC_NAMED_PIPE_HPP +#define IOX_HOOFS_POSIX_IPC_NAMED_PIPE_HPP #include "iceoryx_hoofs/concurrent/lockfree_queue.hpp" #include "iceoryx_platform/semaphore.hpp" #include "iox/builder.hpp" #include "iox/duration.hpp" #include "iox/expected.hpp" -#include "iox/iceoryx_dust_deployment.hpp" +#include "iox/iceoryx_hoofs_deployment.hpp" #include "iox/optional.hpp" #include "iox/posix_ipc_channel.hpp" #include "iox/posix_shared_memory_object.hpp" @@ -176,4 +176,4 @@ class NamedPipeBuilder } // namespace iox -#endif // IOX_DUST_POSIX_IPC_NAMED_PIPE_HPP +#endif // IOX_HOOFS_POSIX_IPC_NAMED_PIPE_HPP diff --git a/iceoryx_dust/posix/ipc/source/message_queue.cpp b/iceoryx_hoofs/posix/ipc/source/message_queue.cpp similarity index 99% rename from iceoryx_dust/posix/ipc/source/message_queue.cpp rename to iceoryx_hoofs/posix/ipc/source/message_queue.cpp index 09dc489bee..c4f3fe9056 100644 --- a/iceoryx_dust/posix/ipc/source/message_queue.cpp +++ b/iceoryx_hoofs/posix/ipc/source/message_queue.cpp @@ -59,7 +59,7 @@ expected MessageQueueBuilder::create() const } // fields have a different order in QNX, so we need to initialize by name - mq_attr attributes; + mq_attr attributes{}; attributes.mq_flags = 0; attributes.mq_maxmsg = static_cast(m_maxMsgNumber); attributes.mq_msgsize = static_cast(m_maxMsgSize); @@ -76,7 +76,7 @@ expected MessageQueueBuilder::create() const } const auto mqDescriptor = openResult.value(); - return ok(MessageQueue{std::move(sanitizedName), attributes, mqDescriptor, m_channelSide}); + return ok(MessageQueue{sanitizedName, attributes, mqDescriptor, m_channelSide}); } MessageQueue::MessageQueue(const PosixIpcChannelName_t& name, diff --git a/iceoryx_dust/posix/ipc/source/named_pipe.cpp b/iceoryx_hoofs/posix/ipc/source/named_pipe.cpp similarity index 97% rename from iceoryx_dust/posix/ipc/source/named_pipe.cpp rename to iceoryx_hoofs/posix/ipc/source/named_pipe.cpp index d8879215fd..bc88f7c0f5 100644 --- a/iceoryx_dust/posix/ipc/source/named_pipe.cpp +++ b/iceoryx_hoofs/posix/ipc/source/named_pipe.cpp @@ -34,6 +34,8 @@ constexpr units::Duration NamedPipe::CYCLE_TIME; constexpr units::Duration NamedPipe::NamedPipeData::WAIT_FOR_INIT_SLEEP_TIME; constexpr units::Duration NamedPipe::NamedPipeData::WAIT_FOR_INIT_TIMEOUT; +// NOLINTJUSTIFICATION the function size and cognitive complexity are cause by the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size,readability-function-cognitive-complexity) expected NamedPipeBuilder::create() const noexcept { if (m_name.size() + strlen(&NamedPipe::NAMED_PIPE_PREFIX[0]) > NamedPipe::MAX_MESSAGE_SIZE) @@ -130,7 +132,7 @@ NamedPipe::NamedPipe(PosixSharedMemoryObject&& sharedMemory, NamedPipeData* data NamedPipe::NamedPipe(NamedPipe&& rhs) noexcept : m_sharedMemory(std::move(rhs.m_sharedMemory)) - , m_data(std::move(rhs.m_data)) + , m_data(rhs.m_data) { rhs.m_data = nullptr; } @@ -173,7 +175,7 @@ PosixIpcChannelName_t NamedPipe::mapToSharedMemoryName(const Prefix& p, const Po expected NamedPipe::destroy() noexcept { - if (m_data) + if (m_data != nullptr) { if (m_sharedMemory.hasOwnership()) { From 726128fa56dbee9b3f23addcbbc114a00e432114 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 04:04:43 +0100 Subject: [PATCH 09/18] iox-#2130 Move 'sync' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- iceoryx_dust/BUILD.bazel | 19 +------------------ iceoryx_dust/CMakeLists.txt | 6 ------ iceoryx_dust/README.md | 1 - iceoryx_hoofs/CMakeLists.txt | 1 + iceoryx_hoofs/README.md | 1 + .../posix/sync/include/iox/signal_watcher.hpp | 7 ++++--- .../posix/sync/source/signal_watcher.cpp | 0 .../test_posix_sync_signal_watcher.cpp | 0 8 files changed, 7 insertions(+), 28 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/posix/sync/include/iox/signal_watcher.hpp (94%) rename {iceoryx_dust => iceoryx_hoofs}/posix/sync/source/signal_watcher.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_posix_sync_signal_watcher.cpp (100%) diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel index 6a8496a190..0877abcdd7 100644 --- a/iceoryx_dust/BUILD.bazel +++ b/iceoryx_dust/BUILD.bazel @@ -17,31 +17,14 @@ load("@rules_cc//cc:defs.bzl", "cc_library") load("//bazel:configure_file.bzl", "configure_file") -configure_file( - name = "iceoryx_dust_deployment_hpp", - src = "cmake/iceoryx_dust_deployment.hpp.in", - out = "generated/include/iox/iceoryx_dust_deployment.hpp", - config = { - "IOX_MAX_NAMED_PIPE_MESSAGE_SIZE": "4096", - "IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES": "10", - }, -) - cc_library( name = "iceoryx_dust", srcs = glob([ "cli/source/**/*.cpp", - "posix/sync/source/**/*.cpp", ]), - hdrs = glob(["cli/**"]) + glob(["memory/**"]) + glob(["utility/**"]) + glob(["posix/ipc/**"]) + glob(["posix/sync/**"]) + [ - ":iceoryx_dust_deployment_hpp", - ], + hdrs = glob(["cli/**"]) + includes = [ "cli/include/", - "generated/include/", - "memory/include/", - "posix/sync/include/", - "utility/include/", ], visibility = ["//visibility:public"], deps = ["//iceoryx_hoofs"], diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index 8579516795..531dce4e01 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -45,20 +45,14 @@ iox_add_library( PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/cli/include - ${PROJECT_SOURCE_DIR}/posix/sync/include - ${PROJECT_SOURCE_DIR}/utility/include - ${CMAKE_BINARY_DIR}/generated/iceoryx_dust/include INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS cli/include/ - posix/sync/include/ - utility/include/ FILES cli/source/arguments.cpp cli/source/command_line_parser.cpp cli/source/option.cpp cli/source/option_definition.cpp cli/source/option_manager.cpp - posix/sync/source/signal_watcher.cpp ) # diff --git a/iceoryx_dust/README.md b/iceoryx_dust/README.md index 114a9dce3b..b652652e83 100644 --- a/iceoryx_dust/README.md +++ b/iceoryx_dust/README.md @@ -10,5 +10,4 @@ grouped together in categories or namespace, depending on where or how they are | class/file | description | |:---------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`FileReader` | Wrapper for opening files and reading them. | -|`SignalWatcher` | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | |`serialization` | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | diff --git a/iceoryx_hoofs/CMakeLists.txt b/iceoryx_hoofs/CMakeLists.txt index 664c8405d6..44cf953fd8 100644 --- a/iceoryx_hoofs/CMakeLists.txt +++ b/iceoryx_hoofs/CMakeLists.txt @@ -127,6 +127,7 @@ iox_add_library( posix/sync/source/mutex.cpp posix/sync/source/named_semaphore.cpp posix/sync/source/signal_handler.cpp + posix/sync/source/signal_watcher.cpp posix/sync/source/semaphore_interface.cpp posix/sync/source/thread.cpp posix/sync/source/unnamed_semaphore.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 266a9e980a..1a09bd9856 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -139,6 +139,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`NamedSemaphore` | | Named semaphore interface, see [ManPage sem_overview](https://man7.org/linux/man-pages/man7/sem_overview.7.html) | |`thread` | | Heap-less replacement for `std::thread`. | |`SignalGuard` | | Helper class for signal handler registration. | +|`SignalWatcher` | | Batteries included signal handling with polling and optional blocking wait for `SIGINT` and `SIGTERM`. | ### Generalized design patterns & abstractions (design) diff --git a/iceoryx_dust/posix/sync/include/iox/signal_watcher.hpp b/iceoryx_hoofs/posix/sync/include/iox/signal_watcher.hpp similarity index 94% rename from iceoryx_dust/posix/sync/include/iox/signal_watcher.hpp rename to iceoryx_hoofs/posix/sync/include/iox/signal_watcher.hpp index 1fb94d34c0..e7d745f7f5 100644 --- a/iceoryx_dust/posix/sync/include/iox/signal_watcher.hpp +++ b/iceoryx_hoofs/posix/sync/include/iox/signal_watcher.hpp @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_POSIX_WRAPPER_SIGNAL_WATCHER_HPP -#define IOX_DUST_POSIX_WRAPPER_SIGNAL_WATCHER_HPP + +#ifndef IOX_HOOFS_POSIX_WRAPPER_SIGNAL_WATCHER_HPP +#define IOX_HOOFS_POSIX_WRAPPER_SIGNAL_WATCHER_HPP #include "iox/optional.hpp" #include "iox/signal_handler.hpp" @@ -82,4 +83,4 @@ void waitForTerminationRequest() noexcept; bool hasTerminationRequested() noexcept; } // namespace iox -#endif +#endif // IOX_HOOFS_POSIX_WRAPPER_SIGNAL_WATCHER_HPP diff --git a/iceoryx_dust/posix/sync/source/signal_watcher.cpp b/iceoryx_hoofs/posix/sync/source/signal_watcher.cpp similarity index 100% rename from iceoryx_dust/posix/sync/source/signal_watcher.cpp rename to iceoryx_hoofs/posix/sync/source/signal_watcher.cpp diff --git a/iceoryx_dust/test/moduletests/test_posix_sync_signal_watcher.cpp b/iceoryx_hoofs/test/moduletests/test_posix_sync_signal_watcher.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_posix_sync_signal_watcher.cpp rename to iceoryx_hoofs/test/moduletests/test_posix_sync_signal_watcher.cpp From c3677c07964cd4bb71c335aba123c500010eef1e Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 06:32:42 +0100 Subject: [PATCH 10/18] iox-#2130 Move 'cli' types from 'iceoryx_dust' to 'iceoryx_hoofs' --- .clang-tidy-diff-scans.txt | 3 + iceoryx_dust/CMakeLists.txt | 19 +----- iceoryx_hoofs/BUILD.bazel | 4 +- iceoryx_hoofs/CMakeLists.txt | 7 +++ iceoryx_hoofs/README.md | 10 ++- .../cli/include/iox/cli/arguments.hpp | 7 ++- .../cli/include/iox/cli/arguments.inl | 10 +-- .../include/iox/cli/command_line_parser.hpp | 19 +++--- .../cli/include/iox/cli/option.hpp | 6 +- .../cli/include/iox/cli/option_definition.hpp | 12 ++-- .../cli/include/iox/cli/option_manager.hpp | 14 ++--- .../cli/include/iox/cli/option_manager.inl | 10 +-- .../cli/include/iox/cli/types.hpp | 6 +- .../cli/include/iox/cli_definition.hpp | 20 +++--- .../cli/source/arguments.cpp | 0 .../cli/source/command_line_parser.cpp | 61 +++++++++++-------- .../cli/source/option.cpp | 10 +-- .../cli/source/option_definition.cpp | 4 +- .../cli/source/option_manager.cpp | 5 +- .../moduletests/test_cli_cli_definition.cpp | 2 + .../test_cli_command_line_common.hpp | 8 ++- .../test_cli_command_line_parser.cpp | 18 +++--- .../test/moduletests/test_cli_option.cpp | 0 .../test_cli_option_definition.cpp | 0 24 files changed, 145 insertions(+), 110 deletions(-) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/arguments.hpp (95%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/arguments.inl (84%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/command_line_parser.hpp (90%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/option.hpp (97%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/option_definition.hpp (92%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/option_manager.hpp (92%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/option_manager.inl (91%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli/types.hpp (94%) rename {iceoryx_dust => iceoryx_hoofs}/cli/include/iox/cli_definition.hpp (93%) rename {iceoryx_dust => iceoryx_hoofs}/cli/source/arguments.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/cli/source/command_line_parser.cpp (82%) rename {iceoryx_dust => iceoryx_hoofs}/cli/source/option.cpp (90%) rename {iceoryx_dust => iceoryx_hoofs}/cli/source/option_definition.cpp (96%) rename {iceoryx_dust => iceoryx_hoofs}/cli/source/option_manager.cpp (90%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_cli_cli_definition.cpp (98%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_cli_command_line_common.hpp (84%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_cli_command_line_parser.cpp (99%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_cli_option.cpp (100%) rename {iceoryx_dust => iceoryx_hoofs}/test/moduletests/test_cli_option_definition.cpp (100%) diff --git a/.clang-tidy-diff-scans.txt b/.clang-tidy-diff-scans.txt index 8f5e354077..5b2662a9b5 100644 --- a/.clang-tidy-diff-scans.txt +++ b/.clang-tidy-diff-scans.txt @@ -3,6 +3,9 @@ ./iceoryx_hoofs/test/moduletests/test_cxx* ./iceoryx_hoofs/source/cxx/* +./iceoryx_hoofs/cli/**/* +./iceoryx_hoofs/test/moduletests/test_cli_* + ./iceoryx_hoofs/memory/**/* ./iceoryx_hoofs/test/moduletests/test_memory_* diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt index 531dce4e01..193184ebae 100644 --- a/iceoryx_dust/CMakeLists.txt +++ b/iceoryx_dust/CMakeLists.txt @@ -37,23 +37,8 @@ set(PREFIX iceoryx/v${CMAKE_PROJECT_VERSION}) ########## build iceoryx dust lib ########## # -iox_add_library( - TARGET iceoryx_dust - NAMESPACE iceoryx_dust - PROJECT_PREFIX ${PREFIX} - PRIVATE_LIBS ${ICEORYX_SANITIZER_FLAGS} - PRIVATE_LIBS_LINUX ${CODE_COVERAGE_LIBS} - PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs - BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/cli/include - INSTALL_INTERFACE include/${PREFIX} - EXPORT_INCLUDE_DIRS cli/include/ - FILES - cli/source/arguments.cpp - cli/source/command_line_parser.cpp - cli/source/option.cpp - cli/source/option_definition.cpp - cli/source/option_manager.cpp -) +add_library(iceoryx_dust INTERFACE) +add_library(iceoryx_dust::iceoryx_dust ALIAS iceoryx_dust) # ########## dust testing ########## diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel index 59e180ff68..d6a0c4aec9 100644 --- a/iceoryx_hoofs/BUILD.bazel +++ b/iceoryx_hoofs/BUILD.bazel @@ -38,6 +38,7 @@ configure_version( cc_library( name = "iceoryx_hoofs", srcs = glob([ + "cli/source/*.cpp", "design/source/*.cpp", "filesystem/source/*.cpp", "memory/source/*.cpp", @@ -56,12 +57,13 @@ cc_library( "utility/source/*.cpp", "vocabulary/source/**/*.cpp", ]), - hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["posix/**"]) + glob(["design/**"]) + glob(["buffer/**"]) + glob(["filesystem/**"]) + glob(["functional/**"]) + glob(["reporting/**"]) + [ + hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["cli/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["posix/**"]) + glob(["design/**"]) + glob(["buffer/**"]) + glob(["filesystem/**"]) + glob(["functional/**"]) + glob(["reporting/**"]) + [ ":iceoryx_hoofs_deployment_hpp", ":iceoryx_versions_h", ], includes = [ "buffer/include/", + "cli/include/", "container/include/", "design/include", "filesystem/include", diff --git a/iceoryx_hoofs/CMakeLists.txt b/iceoryx_hoofs/CMakeLists.txt index 44cf953fd8..22d15ed45c 100644 --- a/iceoryx_hoofs/CMakeLists.txt +++ b/iceoryx_hoofs/CMakeLists.txt @@ -49,6 +49,7 @@ iox_add_library( PRIVATE_LIBS_LINUX acl atomic ${CODE_COVERAGE_LIBS} BUILD_INTERFACE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/legacy/include + ${PROJECT_SOURCE_DIR}/cli/include ${PROJECT_SOURCE_DIR}/memory/include ${PROJECT_SOURCE_DIR}/container/include ${PROJECT_SOURCE_DIR}/vocabulary/include @@ -74,6 +75,7 @@ iox_add_library( INSTALL_INTERFACE include/${PREFIX} EXPORT_INCLUDE_DIRS include/ legacy/include/ + cli/include/ memory/include/ container/include/ vocabulary/include/ @@ -95,6 +97,11 @@ iox_add_library( posix/utility/include/ posix/vocabulary/include/ FILES + cli/source/arguments.cpp + cli/source/command_line_parser.cpp + cli/source/option.cpp + cli/source/option_definition.cpp + cli/source/option_manager.cpp design/source/functional_interface.cpp filesystem/source/file_reader.cpp filesystem/source/filesystem.cpp diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 1a09bd9856..50a6ac780c 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -64,7 +64,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`filesystem` | | Implementation of C++17 filesystem features for instance `iox::access_rights` and `iox::perms` to abstract file permissions | |`PosixAcl` | i | Interface for Access Control Lists (ACL). | |`FileLock` | | File lock C++ wrapping class. | -|`FileReader` | Wrapper for opening files and reading them. | +|`FileReader` | | Wrapper for opening files and reading them. | ### Functional (functional) @@ -83,6 +83,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |`convert` | i | Converting a number into a string is easy, converting it back can be hard. You can use functions like `strtoll`, but you still have to handle errors like under- and overflow, or converting invalid strings into number. Here we abstract all the error handling so that you can convert strings into numbers safely. | |`into` | i | | |`Scheduler` | i | Supported schedulers and functions to get their priority range are contained here. | +|`serialization` | i | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | ### Primitives (primitives) @@ -189,6 +190,13 @@ setTimeout(5_ms); // 5 milliseconds |`posix_group` | | Access to user information. | |`posix_user` | | Access to group information. | + +### Comand line interface (cli) + +| component | internal | description | +|:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|`cli_definition` | | Classes and macros to create command line interfaces. | +
[Check out iceoryx_hoofs on GitHub :fontawesome-brands-github:](https://github.com/eclipse-iceoryx/iceoryx/tree/master/iceoryx_hoofs/){ .md-button }
diff --git a/iceoryx_dust/cli/include/iox/cli/arguments.hpp b/iceoryx_hoofs/cli/include/iox/cli/arguments.hpp similarity index 95% rename from iceoryx_dust/cli/include/iox/cli/arguments.hpp rename to iceoryx_hoofs/cli/include/iox/cli/arguments.hpp index 5a46a88454..6c1c37fb4b 100644 --- a/iceoryx_dust/cli/include/iox/cli/arguments.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/arguments.hpp @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_ARGUMENTS_HPP -#define IOX_DUST_CLI_ARGUMENTS_HPP + +#ifndef IOX_HOOFS_CLI_ARGUMENTS_HPP +#define IOX_HOOFS_CLI_ARGUMENTS_HPP #include "iox/cli/option.hpp" #include "iox/cli/types.hpp" @@ -72,4 +73,4 @@ class Arguments #include "iox/cli/arguments.inl" -#endif // IOX_DUST_CLI_ARGUMENTS_HPP +#endif // IOX_HOOFS_CLI_ARGUMENTS_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/arguments.inl b/iceoryx_hoofs/cli/include/iox/cli/arguments.inl similarity index 84% rename from iceoryx_dust/cli/include/iox/cli/arguments.inl rename to iceoryx_hoofs/cli/include/iox/cli/arguments.inl index 54802ce451..26105ee48f 100644 --- a/iceoryx_dust/cli/include/iox/cli/arguments.inl +++ b/iceoryx_hoofs/cli/include/iox/cli/arguments.inl @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_CLI_DEFINITION_INL -#define IOX_DUST_CLI_CLI_DEFINITION_INL +#ifndef IOX_HOOFS_CLI_CLI_DEFINITION_INL +#define IOX_HOOFS_CLI_CLI_DEFINITION_INL #include "iox/cli/arguments.hpp" @@ -26,7 +26,9 @@ namespace cli template inline expected Arguments::convertFromString(const Argument_t& stringValue) const noexcept { - T value; + // @todo iox-#2055 there are edge cases which lead to not initializing the value even when the return value of + // 'fromString' is true; value initialization can be removed when #2055 is fixed + T value{}; if (!convert::fromString(stringValue.c_str(), value)) { std::cout << "\"" << stringValue.c_str() << "\" could not be converted to the requested type" << std::endl; @@ -63,4 +65,4 @@ inline expected Arguments::get(const OptionName_t& optionNa } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_CLI_DEFINITION_INL +#endif // IOX_HOOFS_CLI_CLI_DEFINITION_INL diff --git a/iceoryx_dust/cli/include/iox/cli/command_line_parser.hpp b/iceoryx_hoofs/cli/include/iox/cli/command_line_parser.hpp similarity index 90% rename from iceoryx_dust/cli/include/iox/cli/command_line_parser.hpp rename to iceoryx_hoofs/cli/include/iox/cli/command_line_parser.hpp index 29f2d81fb1..2bf325ad9c 100644 --- a/iceoryx_dust/cli/include/iox/cli/command_line_parser.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/command_line_parser.hpp @@ -13,8 +13,9 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_COMMAND_PARSER_HPP -#define IOX_DUST_CLI_COMMAND_PARSER_HPP + +#ifndef IOX_HOOFS_CLI_COMMAND_PARSER_HPP +#define IOX_HOOFS_CLI_COMMAND_PARSER_HPP #include "iox/cli/arguments.hpp" #include "iox/cli/option_definition.hpp" @@ -35,17 +36,17 @@ class CommandLineParser private: friend class OptionManager; - friend Arguments parseCommandLineArguments(const OptionDefinition&, int, char*[], const uint64_t) noexcept; + friend Arguments parseCommandLineArguments(const OptionDefinition&, int, char**, const uint64_t) noexcept; /// @brief Parses the arguments from the command line. /// Calls onFailureCallback in optionSet when the command line arguments contain illegal syntax or required /// values are not provided and prints the help. /// @param[in] optionSet the user defined options, based on those options the Arguments object is /// generated - /// @param[in] argc number of arguments, see int main(int argc, char*argv[]) - /// @param[in] argv the string array of arguments, see int main(int argc, char*argv[]) + /// @param[in] argc number of arguments, see int main(int argc, char** argv) + /// @param[in] argv the string array of arguments, see int main(int argc, char** argv) /// @param[in] argcOffset the starting point for the parsing. 1U starts at the first argument. - Arguments parse(const OptionDefinition& optionSet, int argc, char* argv[], const uint64_t argcOffset = 1U) noexcept; + Arguments parse(const OptionDefinition& optionSet, int argc, char** argv, const uint64_t argcOffset = 1U) noexcept; void printHelpAndExit() const noexcept; @@ -55,7 +56,7 @@ class CommandLineParser /// to improve the readability of the code. None of those functions verify /// the pre conditions they require, this has to be done by calling them /// in the correct order. - bool doesFitIntoString(const char* value, const uint64_t maxLength) const noexcept; + static bool doesFitIntoString(const char* value, const uint64_t maxLength) noexcept; bool areAllRequiredValuesPresent() const noexcept; bool hasArguments(const uint64_t argc) const noexcept; bool doesOptionStartWithDash(const char* option) const noexcept; @@ -84,10 +85,10 @@ class CommandLineParser /// @copydoc CommandLineParser::parse() Arguments parseCommandLineArguments(const OptionDefinition& optionSet, int argc, - char* argv[], + char** argv, const uint64_t argcOffset = 1U) noexcept; } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_COMMAND_PARSER_HPP +#endif // IOX_HOOFS_CLI_COMMAND_PARSER_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/option.hpp b/iceoryx_hoofs/cli/include/iox/cli/option.hpp similarity index 97% rename from iceoryx_dust/cli/include/iox/cli/option.hpp rename to iceoryx_hoofs/cli/include/iox/cli/option.hpp index 1429a19302..c5fd7aa8c1 100644 --- a/iceoryx_dust/cli/include/iox/cli/option.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_OPTION_HPP -#define IOX_DUST_CLI_OPTION_HPP +#ifndef IOX_HOOFS_CLI_OPTION_HPP +#define IOX_HOOFS_CLI_OPTION_HPP #include "iox/cli/types.hpp" @@ -97,4 +97,4 @@ struct OptionWithDetails : public Option // can this be melt together } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_OPTION_HPP +#endif // IOX_HOOFS_CLI_OPTION_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/option_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp similarity index 92% rename from iceoryx_dust/cli/include/iox/cli/option_definition.hpp rename to iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp index ee0088ae47..1b9cfdf37a 100644 --- a/iceoryx_dust/cli/include/iox/cli/option_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_OPTION_DEFINITION_HPP -#define IOX_DUST_CLI_OPTION_DEFINITION_HPP +#ifndef IOX_HOOFS_CLI_OPTION_DEFINITION_HPP +#define IOX_HOOFS_CLI_OPTION_DEFINITION_HPP #include "iox/cli/arguments.hpp" #include "iox/cli/types.hpp" @@ -37,10 +37,10 @@ class OptionDefinition /// @brief The constructor. /// @param[in] programDescription The description to the program. Will be printed in the help. /// @param[in] onFailureCallback callback which is called when parse fails, if nothing is - /// defined std::exit(EXIT_FAILURE) is called + /// defined std::quick_exit(EXIT_FAILURE) is called explicit OptionDefinition( const OptionDescription_t& programDescription, - const function onFailureCallback = [] { std::exit(EXIT_FAILURE); }) noexcept; + const function_ref onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) noexcept; /// @brief Adds a command line switch argument /// Calls the onFailureCallback when the option was already added or the shortOption and longOption are @@ -91,8 +91,8 @@ class OptionDefinition function m_onFailureCallback; }; -std::ostream& operator<<(std::ostream& stream, const OptionWithDetails& value) noexcept; +std::ostream& operator<<(std::ostream& stream, const OptionWithDetails& option) noexcept; } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_OPTION_DEFINITION_HPP +#endif // IOX_HOOFS_CLI_OPTION_DEFINITION_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/option_manager.hpp b/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp similarity index 92% rename from iceoryx_dust/cli/include/iox/cli/option_manager.hpp rename to iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp index 1587f4df85..38956a7a70 100644 --- a/iceoryx_dust/cli/include/iox/cli/option_manager.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_OPTION_MANAGER_HPP -#define IOX_DUST_CLI_OPTION_MANAGER_HPP +#ifndef IOX_HOOFS_CLI_OPTION_MANAGER_HPP +#define IOX_HOOFS_CLI_OPTION_MANAGER_HPP #include "iox/cli/command_line_parser.hpp" #include "iox/cli/option_definition.hpp" @@ -40,7 +40,7 @@ class OptionManager /// @param[in] programDescription the description of the application /// @param[in] onFailureCallback callback which is called when a syntax error occurs, a required option is missing /// or the wrong type as argument value is provided - OptionManager(const OptionDescription_t& programDescription, const function onFailureCallback); + OptionManager(const OptionDescription_t& programDescription, const function_ref onFailureCallback); /// @brief Defines a new option /// @param[in] referenceToMember an uninitialized piece of memory where later the content is stored when @@ -61,10 +61,10 @@ class OptionManager /// @brief populates all defined options /// @param[in] binaryName the name of the binary - /// @param[in] argc the argument count taken from int main(int argc, char*argv[]) - /// @param[in] argv the argument array ptr taken from int main(int argc, char*argv[]) + /// @param[in] argc the argument count taken from int main(int argc, char** argv) + /// @param[in] argv the argument array ptr taken from int main(int argc, char** argv) /// @param[in] argcOffset the offset from which the arguments should be parsed - void populateDefinedOptions(const char*& binaryName, int argc, char* argv[], const uint64_t argcOffset); + void populateDefinedOptions(const char*& binaryName, int argc, char** argv, const uint64_t argcOffset); private: CommandLineParser m_parser; @@ -86,4 +86,4 @@ class OptionManager #include "iox/cli/option_manager.inl" -#endif // IOX_DUST_CLI_OPTION_MANAGER_HPP +#endif // IOX_HOOFS_CLI_OPTION_MANAGER_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/option_manager.inl b/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl similarity index 91% rename from iceoryx_dust/cli/include/iox/cli/option_manager.inl rename to iceoryx_hoofs/cli/include/iox/cli/option_manager.inl index a7ea7d355a..9fffb2e5e2 100644 --- a/iceoryx_dust/cli/include/iox/cli/option_manager.inl +++ b/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl @@ -14,9 +14,9 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_OPTION_MANAGER_INL -#define IOX_DUST_CLI_OPTION_MANAGER_INL - +#ifndef IOX_HOOFS_CLI_OPTION_MANAGER_INL +#define IOX_HOOFS_CLI_OPTION_MANAGER_INL +#pragma once #include "iox/cli/option_manager.hpp" namespace iox @@ -51,6 +51,8 @@ inline bool OptionManager::extractOptionArgumentValue(const Arguments& arguments } template +// NOLINTJUSTIFICATION this is not a user facing API but hidden in a macro +// NOLINTNEXTLINE(readability-function-size) inline T OptionManager::defineOption(T& referenceToMember, const char shortName, const OptionName_t& name, @@ -74,4 +76,4 @@ inline T OptionManager::defineOption(T& referenceToMember, } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_OPTION_MANAGER_HPP +#endif // IOX_HOOFS_CLI_OPTION_MANAGER_HPP diff --git a/iceoryx_dust/cli/include/iox/cli/types.hpp b/iceoryx_hoofs/cli/include/iox/cli/types.hpp similarity index 94% rename from iceoryx_dust/cli/include/iox/cli/types.hpp rename to iceoryx_hoofs/cli/include/iox/cli/types.hpp index 8e08760fa1..b37952cca0 100644 --- a/iceoryx_dust/cli/include/iox/cli/types.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/types.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_TYPES_HPP -#define IOX_DUST_CLI_TYPES_HPP +#ifndef IOX_HOOFS_CLI_TYPES_HPP +#define IOX_HOOFS_CLI_TYPES_HPP #include "iceoryx_platform/platform_settings.hpp" #include "iox/string.hpp" @@ -52,4 +52,4 @@ using TypeName_t = string; } // namespace cli } // namespace iox -#endif // IOX_DUST_CLI_TYPES_HPP +#endif // IOX_HOOFS_CLI_TYPES_HPP diff --git a/iceoryx_dust/cli/include/iox/cli_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp similarity index 93% rename from iceoryx_dust/cli/include/iox/cli_definition.hpp rename to iceoryx_hoofs/cli/include/iox/cli_definition.hpp index fd91b3fc0a..7b7d89b6da 100644 --- a/iceoryx_dust/cli/include/iox/cli_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp @@ -14,11 +14,16 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_CLI_CLI_DEFINITION_HPP -#define IOX_DUST_CLI_CLI_DEFINITION_HPP +#ifndef IOX_HOOFS_CLI_CLI_DEFINITION_HPP +#define IOX_HOOFS_CLI_CLI_DEFINITION_HPP #include "iox/cli/option_manager.hpp" + +// NOLINTJUSTIFICATION cannot be realized with templates or constexpr functions due to the +// intended usage of building a class +// NOLINTBEGIN(cppcoreguidelines-macro-usage) + #define IOX_INTERNAL_CMD_LINE_VALUE(type, memberName, defaultValue, shortName, longName, description, optionType) \ public: \ const type& memberName() const noexcept \ @@ -89,14 +94,14 @@ /// // -d or --do-stuff /// // -v or --version /// -/// int main(int argc, char* argv[]) { +/// int main(int argc, char** argv) { /// auto cmd = CommandLine::parse(argc, argv, "My program description"); /// std::cout << cmd.stringValue() << " " << cmd.anotherString() << std::endl; /// } /// @endcode #define IOX_CLI_DEFINITION(Name) \ private: \ - Name(::iox::cli::OptionManager& optionManager, int argc, char* argv[], const uint64_t argcOffset = 1U) \ + Name(::iox::cli::OptionManager& optionManager, int argc, char** argv, const uint64_t argcOffset = 1U) \ : m_optionManager{&optionManager} \ { \ m_optionManager->populateDefinedOptions(m_binaryName, argc, argv, argcOffset); \ @@ -105,10 +110,10 @@ public: \ static Name parse( \ int argc, \ - char* argv[], \ + char** argv, \ const iox::cli::OptionDescription_t& programDescription, \ const uint64_t argcOffset = 1U, \ - const ::iox::function onFailureCallback = [] { std::exit(EXIT_FAILURE); }) \ + const ::iox::function_ref onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) \ { \ ::iox::cli::OptionManager optionManager(programDescription, onFailureCallback); \ return Name(optionManager, argc, argv, argcOffset); \ @@ -123,5 +128,6 @@ ::iox::cli::OptionManager* m_optionManager = nullptr; \ const char* m_binaryName = nullptr +// NOLINTEND(cppcoreguidelines-macro-usage) -#endif // IOX_DUST_CLI_CLI_DEFINITION_HPP +#endif // IOX_HOOFS_CLI_CLI_DEFINITION_HPP diff --git a/iceoryx_dust/cli/source/arguments.cpp b/iceoryx_hoofs/cli/source/arguments.cpp similarity index 100% rename from iceoryx_dust/cli/source/arguments.cpp rename to iceoryx_hoofs/cli/source/arguments.cpp diff --git a/iceoryx_dust/cli/source/command_line_parser.cpp b/iceoryx_hoofs/cli/source/command_line_parser.cpp similarity index 82% rename from iceoryx_dust/cli/source/command_line_parser.cpp rename to iceoryx_hoofs/cli/source/command_line_parser.cpp index e8be12b354..5bdeba88db 100644 --- a/iceoryx_dust/cli/source/command_line_parser.cpp +++ b/iceoryx_hoofs/cli/source/command_line_parser.cpp @@ -26,7 +26,7 @@ namespace iox namespace cli { Arguments -parseCommandLineArguments(const OptionDefinition& optionSet, int argc, char* argv[], const uint64_t argcOffset) noexcept +parseCommandLineArguments(const OptionDefinition& optionSet, int argc, char** argv, const uint64_t argcOffset) noexcept { return CommandLineParser().parse(optionSet, argc, argv, argcOffset); } @@ -43,6 +43,8 @@ bool CommandLineParser::hasArguments(const uint64_t argc) const noexcept bool CommandLineParser::doesOptionStartWithDash(const char* option) const noexcept { + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) const bool doesOptionStartWithDash = (strnlen(option, 1) > 0 && option[0] == '-'); if (!doesOptionStartWithDash) @@ -56,47 +58,53 @@ bool CommandLineParser::doesOptionStartWithDash(const char* option) const noexce bool CommandLineParser::hasNonEmptyOptionName(const char* option) const noexcept { const uint64_t minArgIdentifierLength = strnlen(option, 3); - const bool hasNonEmptyOptionName = - !(minArgIdentifierLength == 1 || (minArgIdentifierLength == 2 && option[1] == '-')); + const bool hasEmptyOptionName = + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + minArgIdentifierLength == 1 || (minArgIdentifierLength == 2 && option[1] == '-'); - if (!hasNonEmptyOptionName) + if (hasEmptyOptionName) { std::cout << "Empty option names are forbidden" << std::endl; printHelpAndExit(); } - return hasNonEmptyOptionName; + return !hasEmptyOptionName; } bool CommandLineParser::doesNotHaveLongOptionDash(const char* option) const noexcept { const uint64_t minArgIdentifierLength = strnlen(option, 3); - const bool doesNotHaveLongOptionDash = !(minArgIdentifierLength > 2 && option[1] != '-'); + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + const bool doesHaveLongOptionDash = minArgIdentifierLength > 2 && option[1] != '-'; - if (!doesNotHaveLongOptionDash) + if (doesHaveLongOptionDash) { std::cout << "Only one letter allowed when using a short option name. The switch \"" << option << "\" is not valid." << std::endl; printHelpAndExit(); } - return doesNotHaveLongOptionDash; + return !doesHaveLongOptionDash; } bool CommandLineParser::doesNotExceedLongOptionDash(const char* option) const noexcept { const uint64_t minArgIdentifierLength = strnlen(option, 3); - const bool doesNotExceedLongOptionDash = !(minArgIdentifierLength > 2 && option[2] == '-'); + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + const bool doesExceedLongOptionDash = minArgIdentifierLength > 2 && option[2] == '-'; - if (!doesNotExceedLongOptionDash) + if (doesExceedLongOptionDash) { std::cout << "A long option name should start after \"--\". This \"" << option << "\" is not valid." << std::endl; printHelpAndExit(); } - return doesNotExceedLongOptionDash; + return !doesExceedLongOptionDash; } -bool CommandLineParser::doesFitIntoString(const char* value, const uint64_t maxLength) const noexcept +bool CommandLineParser::doesFitIntoString(const char* value, const uint64_t maxLength) noexcept { return (strnlen(value, maxLength + 1) <= maxLength); } @@ -117,16 +125,19 @@ bool CommandLineParser::doesOptionNameFitIntoString(const char* option) const no bool CommandLineParser::isNextArgumentAValue(const uint64_t position) const noexcept { uint64_t nextPosition = position + 1; - return (m_argc > 0 && m_argc > nextPosition + return (m_argc > 0 + && m_argc > nextPosition + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) && (strnlen(m_argv[nextPosition], MAX_OPTION_NAME_LENGTH) > 0 && m_argv[nextPosition][0] != '-')); } -bool CommandLineParser::isOptionSet(const OptionWithDetails& value) const noexcept +bool CommandLineParser::isOptionSet(const OptionWithDetails& entry) const noexcept { bool isOptionSet = false; for (const auto& option : m_optionValue.m_arguments) { - if (option.isSameOption(value)) + if (option.isSameOption(entry)) { isOptionSet = true; break; @@ -135,7 +146,7 @@ bool CommandLineParser::isOptionSet(const OptionWithDetails& value) const noexce if (isOptionSet) { - std::cout << "The option \"" << value << "\" is already set!" << std::endl; + std::cout << "The option \"" << entry << "\" is already set!" << std::endl; printHelpAndExit(); } @@ -163,7 +174,7 @@ bool CommandLineParser::hasLexicallyValidOption(const char* value) const noexcep } Arguments -CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char* argv[], const uint64_t argcOffset) noexcept +CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char** argv, const uint64_t argcOffset) noexcept { m_optionSet = &optionSet; @@ -178,6 +189,8 @@ CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char* argv return m_optionValue; } + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) m_optionValue.m_binaryName = m_argv[0]; for (uint64_t i = algorithm::maxVal(argcOffset, static_cast(1U)); i < m_argc; ++i) @@ -228,6 +241,7 @@ CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char* argv skipCommandLineArgument(); } } + // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) setDefaultValuesToUnsetOptions(); @@ -240,13 +254,13 @@ CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char* argv return m_optionValue; } -bool CommandLineParser::doesOptionHasSucceedingValue(const OptionWithDetails& value, +bool CommandLineParser::doesOptionHasSucceedingValue(const OptionWithDetails& entry, const uint64_t position) const noexcept { bool doesOptionHasSucceedingValue = (position + 1 < m_argc); if (!doesOptionHasSucceedingValue) { - std::cout << "The option \"" << value << "\" must be followed by a value!" << std::endl; + std::cout << "The option \"" << entry << "\" must be followed by a value!" << std::endl; printHelpAndExit(); } return doesOptionHasSucceedingValue; @@ -312,6 +326,8 @@ void CommandLineParser::printHelpAndExit() const noexcept std::cout << "Usage: "; for (uint64_t i = 0; i < m_argcOffset && i < m_argc; ++i) { + // NOLINTJUSTIFICATION required for command line options; bounds are checked + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) std::cout << m_argv[i] << " "; } std::cout << "[OPTIONS]\n" << std::endl; @@ -343,12 +359,7 @@ void CommandLineParser::printHelpAndExit() const noexcept outLength += 2 + option.longOption.size(); } - if (option.details.type == OptionType::REQUIRED) - { - std::cout << " [" << option.details.typeName << "]"; - outLength += 3 + option.details.typeName.size(); - } - else if (option.details.type == OptionType::OPTIONAL) + if (option.details.type == OptionType::REQUIRED || option.details.type == OptionType::OPTIONAL) { std::cout << " [" << option.details.typeName << "]"; outLength += 3 + option.details.typeName.size(); diff --git a/iceoryx_dust/cli/source/option.cpp b/iceoryx_hoofs/cli/source/option.cpp similarity index 90% rename from iceoryx_dust/cli/source/option.cpp rename to iceoryx_hoofs/cli/source/option.cpp index e483251ba7..ba334d92da 100644 --- a/iceoryx_dust/cli/source/option.cpp +++ b/iceoryx_hoofs/cli/source/option.cpp @@ -71,13 +71,15 @@ bool Option::operator<(const Option& rhs) const noexcept { return shortOption < rhs.shortOption; } - else if (!longOption.empty() && rhs.shortOption != NO_SHORT_OPTION) + + if (!longOption.empty() && rhs.shortOption != NO_SHORT_OPTION) { - return longOption.c_str()[0] < rhs.shortOption; + return longOption.unchecked_at(0) < rhs.shortOption; } - else if (shortOption != NO_SHORT_OPTION && !rhs.longOption.empty()) + + if (shortOption != NO_SHORT_OPTION && !rhs.longOption.empty()) { - return shortOption < rhs.longOption.c_str()[0]; + return shortOption < rhs.longOption.unchecked_at(0); } return longOption < rhs.longOption; diff --git a/iceoryx_dust/cli/source/option_definition.cpp b/iceoryx_hoofs/cli/source/option_definition.cpp similarity index 96% rename from iceoryx_dust/cli/source/option_definition.cpp rename to iceoryx_hoofs/cli/source/option_definition.cpp index c33f1e865b..7ab3ee439d 100644 --- a/iceoryx_dust/cli/source/option_definition.cpp +++ b/iceoryx_hoofs/cli/source/option_definition.cpp @@ -22,7 +22,7 @@ namespace iox namespace cli { OptionDefinition::OptionDefinition(const OptionDescription_t& programDescription, - const function onFailureCallback) noexcept + const function_ref onFailureCallback) noexcept : m_programDescription{programDescription} , m_onFailureCallback{onFailureCallback} { @@ -103,6 +103,8 @@ OptionDefinition& OptionDefinition::addSwitch(const char shortOption, return addOption({{shortOption, IS_SWITCH, longOption, {""}}, description, OptionType::SWITCH, {""}}); } +// NOLINTJUSTIFICATION this is not a user facing API but hidden in a macro +// NOLINTNEXTLINE(readability-function-size) OptionDefinition& OptionDefinition::addOptional(const char shortOption, const OptionName_t& longOption, const OptionDescription_t& description, diff --git a/iceoryx_dust/cli/source/option_manager.cpp b/iceoryx_hoofs/cli/source/option_manager.cpp similarity index 90% rename from iceoryx_dust/cli/source/option_manager.cpp rename to iceoryx_hoofs/cli/source/option_manager.cpp index e833f2371b..b5f93a9395 100644 --- a/iceoryx_dust/cli/source/option_manager.cpp +++ b/iceoryx_hoofs/cli/source/option_manager.cpp @@ -20,12 +20,13 @@ namespace iox { namespace cli { -OptionManager::OptionManager(const OptionDescription_t& programDescription, const function onFailureCallback) +OptionManager::OptionManager(const OptionDescription_t& programDescription, + const function_ref onFailureCallback) : m_optionSet{programDescription, onFailureCallback} { } -void OptionManager::populateDefinedOptions(const char*& binaryName, int argc, char* argv[], const uint64_t argcOffset) +void OptionManager::populateDefinedOptions(const char*& binaryName, int argc, char** argv, const uint64_t argcOffset) { auto options = m_parser.parse(m_optionSet, argc, argv, argcOffset); diff --git a/iceoryx_dust/test/moduletests/test_cli_cli_definition.cpp b/iceoryx_hoofs/test/moduletests/test_cli_cli_definition.cpp similarity index 98% rename from iceoryx_dust/test/moduletests/test_cli_cli_definition.cpp rename to iceoryx_hoofs/test/moduletests/test_cli_cli_definition.cpp index cb4dafc4b8..bb9b8eacef 100644 --- a/iceoryx_dust/test/moduletests/test_cli_cli_definition.cpp +++ b/iceoryx_hoofs/test/moduletests/test_cli_cli_definition.cpp @@ -62,6 +62,8 @@ class CliDefinition_test : public Test struct CliDefinitionSut { + // NOLINTJUSTIFICATION hidden behind a macro + // NOLINTNEXTLINE(readability-function-size) IOX_CLI_DEFINITION(CliDefinitionSut); IOX_CLI_OPTIONAL(string<100>, stringValue1, {"default value"}, 's', {"string-value-1"}, {"some description"}); diff --git a/iceoryx_dust/test/moduletests/test_cli_command_line_common.hpp b/iceoryx_hoofs/test/moduletests/test_cli_command_line_common.hpp similarity index 84% rename from iceoryx_dust/test/moduletests/test_cli_command_line_common.hpp rename to iceoryx_hoofs/test/moduletests/test_cli_command_line_common.hpp index f2eb16d372..9c78b4512a 100644 --- a/iceoryx_dust/test/moduletests/test_cli_command_line_common.hpp +++ b/iceoryx_hoofs/test/moduletests/test_cli_command_line_common.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP -#define IOX_DUST_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP +#ifndef IOX_HOOFS_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP +#define IOX_HOOFS_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP #include #include @@ -35,6 +35,8 @@ struct CmdArgs contents = std::make_unique>(arguments); for (uint64_t i = 0; i < static_cast(argc); ++i) { + // NOLINTJUSTIFICATION required for test + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) argv[i] = (*contents)[i].data(); } } @@ -74,4 +76,4 @@ class OutBuffer std::stringstream m_capture; }; -#endif // IOX_DUST_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP +#endif // IOX_HOOFS_MODULETESTS_TEST_CLI_COMMAND_LINE_COMMON_HPP diff --git a/iceoryx_dust/test/moduletests/test_cli_command_line_parser.cpp b/iceoryx_hoofs/test/moduletests/test_cli_command_line_parser.cpp similarity index 99% rename from iceoryx_dust/test/moduletests/test_cli_command_line_parser.cpp rename to iceoryx_hoofs/test/moduletests/test_cli_command_line_parser.cpp index 9ef523814d..6fbdb00978 100644 --- a/iceoryx_dust/test/moduletests/test_cli_command_line_parser.cpp +++ b/iceoryx_hoofs/test/moduletests/test_cli_command_line_parser.cpp @@ -82,6 +82,8 @@ TEST_F(CommandLineParser_test, EmptyArgcLeadsToExit) EXPECT_THAT(numberOfErrorCallbackCalls, Eq(1)); } +// NOLINTJUSTIFICATION okay for tests +// NOLINTNEXTLINE(bugprone-easily-swappable-parameters) void FailureTest(const std::vector& options, const std::vector& optionsToRegister = {}, const std::vector& switchesToRegister = {}, @@ -320,13 +322,7 @@ TEST_F(CommandLineParser_test, FailWhenOptionWasNotRegistered_MultiArgument_Shor ::testing::Test::RecordProperty("TEST_ID", "a4de02ed-3057-4d54-bcad-5a55ed8ea9ed"); std::vector optionsToRegister{"sputnik", "rosetta"}; // begin - FailureTest({"-c", - "gameOfLife", - "-s", - "iWasFirst" - "-r", - "uhWhatsThere"}, - optionsToRegister); + FailureTest({"-c", "gameOfLife", "-s", "iWasFirst", "-r", "uhWhatsThere"}, optionsToRegister); // middle FailureTest({"-s", "gameOfLife", "-c", "gameOfLife", "-r", "uhWhatsThere"}, optionsToRegister); // end @@ -857,7 +853,7 @@ TEST_F(CommandLineParser_test, DefaultValuesAreLoadedForLongOptionsOnly) TEST_F(CommandLineParser_test, DetectMissingRequiredOptionsWithShortOptionsOnly) { ::testing::Test::RecordProperty("TEST_ID", "a414b0f8-88cc-4a0a-bc73-c9be1f5dcc79"); - bool wasErrorHandlerCalled; + bool wasErrorHandlerCalled{false}; OptionDefinition optionSet("", [&] { wasErrorHandlerCalled = true; }); optionSet.addRequired('a', "", "", "int"); optionSet.addRequired('b', "", "", "int"); @@ -871,7 +867,7 @@ TEST_F(CommandLineParser_test, DetectMissingRequiredOptionsWithShortOptionsOnly) TEST_F(CommandLineParser_test, DetectMissingRequiredOptionsWithLongOptionsOnly) { ::testing::Test::RecordProperty("TEST_ID", "8115efb2-9ddf-4457-9d69-526f215d974a"); - bool wasErrorHandlerCalled; + bool wasErrorHandlerCalled{false}; OptionDefinition optionSet("", [&] { wasErrorHandlerCalled = true; }); optionSet.addRequired(iox::cli::NO_SHORT_OPTION, "alpha", "", "int"); optionSet.addRequired(iox::cli::NO_SHORT_OPTION, "beta", "", "int"); @@ -882,6 +878,8 @@ TEST_F(CommandLineParser_test, DetectMissingRequiredOptionsWithLongOptionsOnly) EXPECT_THAT(wasErrorHandlerCalled, Eq(true)); } +// NOLINTJUSTIFICATION okay for tests +// NOLINTNEXTLINE(bugprone-easily-swappable-parameters, readability-function-size) Arguments SuccessTest(const std::vector& options, const std::vector& optionsToRegister = {}, const std::vector& switchesToRegister = {}, @@ -1279,7 +1277,7 @@ TEST_F(CommandLineParser_test, SuccessfulConversionToNumbers) verifyEntry(option, "a-opt", {123}); verifyEntry(option, "i-req", {-456}); - verifyEntry(option, "j-req", {123.123f}); + verifyEntry(option, "j-req", {123.123F}); verifyEntry(option, "g-req", {-891.19012}); } diff --git a/iceoryx_dust/test/moduletests/test_cli_option.cpp b/iceoryx_hoofs/test/moduletests/test_cli_option.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_cli_option.cpp rename to iceoryx_hoofs/test/moduletests/test_cli_option.cpp diff --git a/iceoryx_dust/test/moduletests/test_cli_option_definition.cpp b/iceoryx_hoofs/test/moduletests/test_cli_option_definition.cpp similarity index 100% rename from iceoryx_dust/test/moduletests/test_cli_option_definition.cpp rename to iceoryx_hoofs/test/moduletests/test_cli_option_definition.cpp From b323a66fcebf94919a096ca61bf8de86b3153765 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 06:33:15 +0100 Subject: [PATCH 11/18] iox-#2130 Remove 'iceoryx_dust' --- README.md | 1 - .../iceoryx_components_diagram_v3_0_0.puml | 14 - .../iceoryx_software_layers_v3_0_0.puml | 9 +- doc/design/move_and_copy_helper.md | 2 +- .../iceoryx_components_diagram_v3_0_0.svg | 400 +++--------------- .../images/iceoryx_software_layers_v3_0_0.svg | 28 +- .../release-notes/iceoryx-unreleased.md | 15 +- iceoryx_dust/BUILD.bazel | 31 -- iceoryx_dust/CMakeLists.txt | 57 --- iceoryx_dust/README.md | 13 - iceoryx_dust/cmake/Config.cmake.in | 26 -- iceoryx_dust/cmake/iceoryx_dustConfig.cmake | 25 -- .../cmake/iceoryx_dust_testingConfig.cmake | 24 -- iceoryx_dust/package.xml | 25 -- iceoryx_dust/test/BUILD.bazel | 44 -- iceoryx_dust/test/CMakeLists.txt | 56 --- .../test_dust_integration.cpp | 31 -- .../test/moduletests/test_dust_modules.cpp | 32 -- iceoryx_dust/test/test.hpp | 24 -- iceoryx_examples/complexdata/CMakeLists.txt | 1 - iceoryx_examples/iceperf/CMakeLists.txt | 1 - iceoryx_integrationtest/package.xml | 1 - iceoryx_meta/CMakeLists.txt | 1 - iceoryx_meta/tests.cmake | 2 +- iceoryx_posh/BUILD.bazel | 1 - iceoryx_posh/CMakeLists.txt | 2 - iceoryx_posh/cmake/Config.cmake.in | 1 - iceoryx_posh/package.xml | 1 - 28 files changed, 96 insertions(+), 772 deletions(-) delete mode 100644 iceoryx_dust/BUILD.bazel delete mode 100644 iceoryx_dust/CMakeLists.txt delete mode 100644 iceoryx_dust/README.md delete mode 100644 iceoryx_dust/cmake/Config.cmake.in delete mode 100644 iceoryx_dust/cmake/iceoryx_dustConfig.cmake delete mode 100644 iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake delete mode 100644 iceoryx_dust/package.xml delete mode 100644 iceoryx_dust/test/BUILD.bazel delete mode 100644 iceoryx_dust/test/CMakeLists.txt delete mode 100644 iceoryx_dust/test/integrationtests/test_dust_integration.cpp delete mode 100644 iceoryx_dust/test/moduletests/test_dust_modules.cpp delete mode 100644 iceoryx_dust/test/test.hpp diff --git a/README.md b/README.md index 6f55498146..785fa7805b 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,6 @@ Please see the [Quality Declaration](./QUALITY_DECLARATION.md) for details of th |-----------------------|:-------------:|:-----------------:|:---------------------------------------:| | iceoryx_hoofs | 2 | 1+ | 1 | | iceoryx_posh | 2 | 1+, 2 | 1 | -| iceoryx_dust | 2 | 2 | 2 | | iceoryx_binding_c | 2 | 2 | 2 | | iceoryx_examples | 5 | 4 | 4 | | iceoryx_introspection | 5 | 4 | 4 | diff --git a/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml b/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml index 71062cc8b1..783773f75d 100644 --- a/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml +++ b/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml @@ -55,17 +55,6 @@ package iceoryx_hoofs { } } -' DUST: Deemed Useful Software Thingies -' Library containing modern C++ STL constructs with quality level 2 -package iceoryx_dust { - frame "dust library" { - component "Containers" <> as additional_containers - component "Filesystem" <> as additional_filesystem - component "Buffers" <> as additional_buffers - component "Inter-process communication" <> as additional_ipc - } -} - ' POSH: POSIX SHared memory ' Publish/subscribe IPC communication infrastructure based on shared memory package iceoryx_posh { @@ -128,10 +117,7 @@ package iceoryx_introspection { } iceoryx_hoofs ..> iceoryx_platform : use -iceoryx_dust ..> iceoryx_platform : use iceoryx_posh ..> iceoryx_hoofs : use -iceoryx_dust ..> iceoryx_hoofs : use -iceoryx_posh ..> iceoryx_dust : use iceoryx_dds ..> iceoryx_posh : use iceoryx_rs ..> iceoryx_posh : use automotive_soa ..> iceoryx_posh : use diff --git a/doc/design/diagrams/iceoryx_software_layers_v3_0_0.puml b/doc/design/diagrams/iceoryx_software_layers_v3_0_0.puml index c35eb422b0..c8ccf0b33a 100644 --- a/doc/design/diagrams/iceoryx_software_layers_v3_0_0.puml +++ b/doc/design/diagrams/iceoryx_software_layers_v3_0_0.puml @@ -18,24 +18,19 @@ skinparam frame { } [iceoryx_platform] -[iceoryx_dust] [iceoryx_hoofs] [iceoryx_posh] [iceoryx_binding_c] [C user app] [C++ user app] -note right of iceoryx_platform : Basic platform support library with quality level 1+ -note top of iceoryx_hoofs : Basic building block library with quality level 1+ -note top of iceoryx_dust : Basic building block library with quality level 2 +note right of iceoryx_platform : Basic platform support library +note top of iceoryx_hoofs : Basic building block library note top of iceoryx_posh : Shared memory transport (POsix SHared memory) note right of iceoryx_binding_c : C API for iceoryx_posh [iceoryx_hoofs] ..> [iceoryx_platform] -[iceoryx_dust] ..> [iceoryx_platform] [iceoryx_posh] ..> [iceoryx_hoofs] -[iceoryx_dust] ..> [iceoryx_hoofs] -[iceoryx_posh] ..> [iceoryx_dust] [iceoryx_binding_c] ..> [iceoryx_posh] [C user app] ..> [iceoryx_binding_c] [C++ user app] ..> [iceoryx_posh] diff --git a/doc/design/move_and_copy_helper.md b/doc/design/move_and_copy_helper.md index c2dbaae2a0..64a83b7ed9 100644 --- a/doc/design/move_and_copy_helper.md +++ b/doc/design/move_and_copy_helper.md @@ -149,4 +149,4 @@ void Test::copy_and_move_impl(RhsType&& rhs) For more examples, see -- `iceoryx_dust/container/detail/fixed_position_container.inl` +- `iceoryx_hoofs/container/detail/fixed_position_container.inl` diff --git a/doc/website/images/iceoryx_components_diagram_v3_0_0.svg b/doc/website/images/iceoryx_components_diagram_v3_0_0.svg index d133986b01..48634e1b70 100644 --- a/doc/website/images/iceoryx_components_diagram_v3_0_0.svg +++ b/doc/website/images/iceoryx_components_diagram_v3_0_0.svg @@ -1,331 +1,69 @@ - -Eclipse iceoryx component overviewEclipse iceoryx Component Overviewiceoryx_platformplatform libraryiceoryx_hoofshoofs libraryiceoryx_dustdust libraryiceoryx_poshcore libraryruntime librarygateway libraryconfig libraryRouDi libraryiceoryx_ddsiceoryx_binding_ciceoryx_introspection«namespace»client«module»Platform abstraction«module»Memory & lifetime management«module»Containers«module»Vocabulary types«module»Filesystem«module»Functional«module»Utility«module»Primitives«module»Buffers«module»Inter-process communication«module»Threads & sychronisation«module»Generalized design patterns & abstractions«module»Reporting«module»Time«module»Containers«module»Filesystem«module»Buffers«module»Inter-process communication«namespace»errors«namespace»popo«namespace»capro«namespace»mepoo«namespace»version«namespace»build«namespace»runtime«namespace»gw«namespace»config«namespace»roudi«namespace»dds«namespace»gwautomotive_soaiceoryx_rs«namespace»cpp2c«namespace»c2cpp«namespace»introspectionuseuseuseuseuseuseuseuseuseuse +Eclipse iceoryx component overviewEclipse iceoryx Component Overviewiceoryx_platformplatform libraryiceoryx_hoofshoofs libraryiceoryx_poshcore libraryruntime librarygateway libraryconfig libraryRouDi libraryiceoryx_ddsiceoryx_binding_ciceoryx_introspection«namespace»client«module»Platform abstraction«module»Memory & lifetime management«module»Containers«module»Vocabulary types«module»Filesystem«module»Functional«module»Utility«module»Primitives«module»Buffers«module»Inter-process communication«module»Threads & sychronisation«module»Generalized design patterns & abstractions«module»Reporting«module»Time«namespace»errors«namespace»popo«namespace»capro«namespace»mepoo«namespace»version«namespace»build«namespace»runtime«namespace»gw«namespace»config«namespace»roudi«namespace»dds«namespace»gwautomotive_soaiceoryx_rs«namespace»cpp2c«namespace»c2cpp«namespace»introspectionuseuseuseuseuseuseuse \ No newline at end of file diff --git a/doc/website/images/iceoryx_software_layers_v3_0_0.svg b/doc/website/images/iceoryx_software_layers_v3_0_0.svg index 154130010c..8837d07a6f 100644 --- a/doc/website/images/iceoryx_software_layers_v3_0_0.svg +++ b/doc/website/images/iceoryx_software_layers_v3_0_0.svg @@ -1,16 +1,12 @@ -Eclipse iceoryx software layers (v3.0.0)iceoryx_platformiceoryx_dusticeoryx_hoofsiceoryx_poshiceoryx_binding_cC user appC++ user appBasic platform support library with quality level 1+Basic building block library with quality level 1+Basic building block library with quality level 2Shared memory transport (POsix SHared memory)C API for iceoryx_posh \ No newline at end of file +Eclipse iceoryx software layers (v3.0.0)iceoryx_platformiceoryx_hoofsiceoryx_poshiceoryx_binding_cC user appC++ user appBasic platform support libraryBasic building block libraryShared memory transport (POsix SHared memory)C API for iceoryx_posh \ No newline at end of file diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index e9a2c50674..18cbb7c989 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -147,6 +147,7 @@ - `SignalHandler` returns an `iox::expected` in `registerSignalHandler` [\#1196](https://github.com/eclipse-iceoryx/iceoryx/issues/1196) - Remove the unused `PosixRights` struct [\#1556](https://github.com/eclipse-iceoryx/iceoryx/issues/1556) - Move quality level 2 classes to new package `iceoryx_dust` [\#590](https://github.com/eclipse-iceoryx/iceoryx/issues/590) + - moved back to `hoofs` - Remove unused classes from `iceoryx_hoofs` [\#590](https://github.com/eclipse-iceoryx/iceoryx/issues/590) - `cxx::PoorMansHeap` - Other `internal` classes @@ -168,18 +169,23 @@ - Replace uses of `std::cout`, `std::cerr` with the iceoryx logger [\#1756](https://github.com/eclipse-iceoryx/iceoryx/issues/1756) - Move `IOX_NO_DISCARD`, `IOX_FALLTHROUGH` and `IOX_MAYBE_UNUSED` to `iceoryx_platform` [\#1726](https://github.com/eclipse-iceoryx/iceoryx/issues/1726) - Move `cxx::static_storage` from `iceoryx_hoofs` to `iceoryx_dust` [\#1732](https://github.com/eclipse-iceoryx/iceoryx/issues/1732) + - moved back to `hoofs` - Remove `algorithm::uniqueMergeSortedContainers` from `algorithm.hpp` - Move `std::string` conversion function to `iceoryx_dust` [\#1612](https://github.com/eclipse-iceoryx/iceoryx/issues/1612) + - moved back to `hoofs` - The posix call `unlink` is directly used in `UnixDomainSocket` [\#1622](https://github.com/eclipse-iceoryx/iceoryx/issues/1622) - Wrap all C calls in posixCall in IntrospectionApp [\#1692](https://github.com/eclipse-iceoryx/iceoryx/issues/1692) - Move `std::chrono` dependency to `iceoryx_dust` [\#536](https://github.com/eclipse-iceoryx/iceoryx/issues/536) + - moved back to `hoofs` - Move `std::string` dependency from `iox::string` to `std_string_support.hpp` in `iceoryx_dust` [\#1612](https://github.com/eclipse-iceoryx/iceoryx/issues/1612) + - moved back to `hoofs` - Better align `iox::expected` with `std::expected` [\#1969](https://github.com/eclipse-iceoryx/iceoryx/issues/1969) - Use logger for "RouDi is ready for clients" message [\#1994](https://github.com/eclipse-iceoryx/iceoryx/issues/1994) - Speed up posh tests [#1030](https://github.com/eclipse-iceoryx/iceoryx/issues/1030) - Roudi Environment independent from Googletest [#1533](https://github.com/eclipse-iceoryx/iceoryx/issues/1533) - Move test class for ctor and assignment operators to hoofs testing [#2041](https://github.com/eclipse-iceoryx/iceoryx/issues/2041) - Refactor `FixedPositionContainer` and move to `dust` [#2044](https://github.com/eclipse-iceoryx/iceoryx/issues/2044) + - final location is `hoofs` - Cleanup or Remove ObjectPool [#66](https://github.com/eclipse-iceoryx/iceoryx/issues/66) - Improve process is alive detection [#1361](https://github.com/eclipse-iceoryx/iceoryx/issues/1361) - only partially @@ -187,6 +193,7 @@ - Removed IOX_INTERNAL_MAX_NUMBER_OF_NOTIFIERS and made IOX_MAX_NUMBER_OF_NOTIFIERS configurable again [#2083](https://github.com/eclipse-iceoryx/iceoryx/issues/2083) - Setting IOX_NO_DISCARD in QNX [#638](https://github.com/eclipse-iceoryx/iceoryx/issues/638) - Replace `iox::byte_t` with std::byte [#1900](https://github.com/eclipse-iceoryx/iceoryx/issues/1900) +- Merge `iceoryx_dust` back to `iceoryx_hoofs` [#2130](https://github.com/eclipse-iceoryx/iceoryx/issues/2130) **Workflow:** @@ -958,7 +965,7 @@ ``` -42. Move multiple classes from `iceoryx_hoofs` to `iceoryx_dust` +42. ~~Move multiple classes from `iceoryx_hoofs` to `iceoryx_dust`~~ They are still in `iceoryx_hoofs` but the include path changed nevertheless ```cpp // before @@ -997,7 +1004,7 @@ #include "iceoryx_hoofs/internal/objectpool/objectpool.hpp" // after - #include "iceoryx_dust/cxx/objectpool.hpp" + // fully removed ``` ```cpp @@ -1048,7 +1055,7 @@ #include "iox/detail/convert.hpp" ``` -43. Move the conversions functions for `std::string` to `iceoryx_dust`: +43. ~~Move the conversions functions for `std::string` to `iceoryx_dust`:~~ They are still in `iceoryx_hoofs` but the include path changed nevertheless ```cpp // before @@ -1135,7 +1142,7 @@ std::byte m_size; ``` -48. Move conversion methods from `duration.hpp` to `iceoryx_dust` +48. ~~Move conversion methods from `duration.hpp` to `iceoryx_dust`~~ They are still in `iceoryx_hoofs` but the include path changed nevertheless ```cpp // before diff --git a/iceoryx_dust/BUILD.bazel b/iceoryx_dust/BUILD.bazel deleted file mode 100644 index 0877abcdd7..0000000000 --- a/iceoryx_dust/BUILD.bazel +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -load("@rules_cc//cc:defs.bzl", "cc_library") -load("//bazel:configure_file.bzl", "configure_file") - -cc_library( - name = "iceoryx_dust", - srcs = glob([ - "cli/source/**/*.cpp", - ]), - hdrs = glob(["cli/**"]) + - includes = [ - "cli/include/", - ], - visibility = ["//visibility:public"], - deps = ["//iceoryx_hoofs"], -) diff --git a/iceoryx_dust/CMakeLists.txt b/iceoryx_dust/CMakeLists.txt deleted file mode 100644 index 193184ebae..0000000000 --- a/iceoryx_dust/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.16) - -set(IOX_VERSION_STRING "2.90.0") - -project(iceoryx_dust VERSION ${IOX_VERSION_STRING}) - -find_package(iceoryx_platform REQUIRED) -find_package(iceoryx_hoofs REQUIRED) - -include(IceoryxPackageHelper) -include(IceoryxPlatform) -include(IceoryxPlatformSettings) - -if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin) - option(BUILD_SHARED_LIBS "Create shared libraries by default" ON) -endif() - -set(PREFIX iceoryx/v${CMAKE_PROJECT_VERSION}) - -# -########## build iceoryx dust lib ########## -# - -add_library(iceoryx_dust INTERFACE) -add_library(iceoryx_dust::iceoryx_dust ALIAS iceoryx_dust) - -# -########## dust testing ########## -# - -# Finding gtest and adding the subdirectories is split to support the use case of -# building the testing lib without the tests by providing gtest externally -if(NOT GTest_FOUND AND BUILD_TEST) - find_package(GTest CONFIG REQUIRED) -endif() - -if(GTest_FOUND) - if(BUILD_TEST) - add_subdirectory(test) - endif() -endif() diff --git a/iceoryx_dust/README.md b/iceoryx_dust/README.md deleted file mode 100644 index b652652e83..0000000000 --- a/iceoryx_dust/README.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Eclipse iceoryx dust overview - -Similar to iceoryx hoofs `iceoryx_dust` (**D**eemed **u**seful **s**oftware **t**hingies) is a library for basic building blocks. -Compared to hoofs classes in `iceoryx_dust`, the difference is that the classes in dust only conform to quality level 2. - -There are a wide variety of building blocks -grouped together in categories or namespace, depending on where or how they are used. - -| class/file | description | -|:---------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|`FileReader` | Wrapper for opening files and reading them. | -|`serialization` | Implements a simple serialization concept for classes based on the idea presented here [ISOCPP serialization](https://isocpp.org/wiki/faq/serialization#serialize-text-format). | diff --git a/iceoryx_dust/cmake/Config.cmake.in b/iceoryx_dust/cmake/Config.cmake.in deleted file mode 100644 index f175d3395b..0000000000 --- a/iceoryx_dust/cmake/Config.cmake.in +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2020 by Robert Bosch GmbH All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) - -find_dependency(iceoryx_platform) -find_dependency(iceoryx_hoofs) - -include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") -list(APPEND CMAKE_MODULE_PATH "@DESTINATION_CONFIGDIR@") -check_required_components("@PROJECT_NAME@") diff --git a/iceoryx_dust/cmake/iceoryx_dustConfig.cmake b/iceoryx_dust/cmake/iceoryx_dustConfig.cmake deleted file mode 100644 index 7b83c1707d..0000000000 --- a/iceoryx_dust/cmake/iceoryx_dustConfig.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# -########## dummyConfig.cmake to be able to use find_package with the source tree ########## -# - -if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) - message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") - set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") -endif() - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake b/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake deleted file mode 100644 index f347a114d0..0000000000 --- a/iceoryx_dust/cmake/iceoryx_dust_testingConfig.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# -########## dummyConfig.cmake to be able to use find_package with the source tree ########## -# - -if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) - message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") - set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") -endif() diff --git a/iceoryx_dust/package.xml b/iceoryx_dust/package.xml deleted file mode 100644 index ffd9d913b4..0000000000 --- a/iceoryx_dust/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - iceoryx_dust - 2.90.0 - Eclipse iceoryx inter-process-communication (IPC) middleware deemed usefule software thingies - Eclipse Foundation, Inc. - Apache 2.0 - https://iceoryx.io - https://github.com/eclipse-iceoryx/iceoryx/issues - https://github.com/eclipse-iceoryx/iceoryx - - cmake - - acl - libatomic - iceoryx_hoofs - - - doxygen - - - cmake - - diff --git a/iceoryx_dust/test/BUILD.bazel b/iceoryx_dust/test/BUILD.bazel deleted file mode 100644 index f919457380..0000000000 --- a/iceoryx_dust/test/BUILD.bazel +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -load("@rules_cc//cc:defs.bzl", "cc_test") - -cc_test( - name = "dust_moduletests", - srcs = glob([ - "moduletests/*.cpp", - "moduletests/*.hpp", - "*.hpp", - ]), - includes = [ - ".", - "moduletests", - ], - linkopts = select({ - "//iceoryx_platform:linux": ["-ldl"], - "//iceoryx_platform:mac": [], - "//iceoryx_platform:qnx": [], - "//iceoryx_platform:unix": [], - "//iceoryx_platform:win": [], - "//conditions:default": ["-ldl"], - }), - tags = ["exclusive"], - visibility = ["//visibility:private"], - deps = [ - "//iceoryx_dust", - "//iceoryx_hoofs:iceoryx_hoofs_testing", - ], -) diff --git a/iceoryx_dust/test/CMakeLists.txt b/iceoryx_dust/test/CMakeLists.txt deleted file mode 100644 index b18e40b17d..0000000000 --- a/iceoryx_dust/test/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2019 - 2020 by Robert Bosch GmbH. All rights reserved. -# Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.16) -set(test_iceoryx_dust_VERSION 0) -project(test_iceoryx_dust VERSION ${test_iceoryx_dust_VERSION}) - -find_package(Threads REQUIRED) -find_package(iceoryx_hoofs_testing REQUIRED) - -set(PROJECT_PREFIX "dust") - -file(GLOB_RECURSE MODULETESTS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/moduletests/*.cpp") -file(GLOB_RECURSE INTEGRATIONTESTS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/integrationtests/*.cpp") - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_PREFIX}/test) - -set(TEST_LINK_LIBS - ${CODE_COVERAGE_LIBS} - GTest::gtest - GTest::gmock - iceoryx_dust::iceoryx_dust - iceoryx_hoofs::iceoryx_hoofs - iceoryx_hoofs_testing::iceoryx_hoofs_testing -) - -iox_add_executable( TARGET ${PROJECT_PREFIX}_moduletests - INCLUDE_DIRECTORIES . - LIBS ${TEST_LINK_LIBS} - LIBS_LINUX acl dl rt - FILES ${MODULETESTS_SRC} -) - -iox_add_executable( TARGET ${PROJECT_PREFIX}_integrationtests - INCLUDE_DIRECTORIES . - LIBS ${TEST_LINK_LIBS} - LIBS_LINUX acl dl rt - FILES ${INTEGRATIONTESTS_SRC} -) - -target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${ICEORYX_TEST_CXX_FLAGS}) -target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${ICEORYX_TEST_CXX_FLAGS}) diff --git a/iceoryx_dust/test/integrationtests/test_dust_integration.cpp b/iceoryx_dust/test/integrationtests/test_dust_integration.cpp deleted file mode 100644 index 21fe025c35..0000000000 --- a/iceoryx_dust/test/integrationtests/test_dust_integration.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 - 2022 by Apex.AI inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/testing/testing_logger.hpp" - -#include "test.hpp" - -using namespace ::testing; - -int main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - - iox::testing::TestingLogger::init(); - - return RUN_ALL_TESTS(); -} diff --git a/iceoryx_dust/test/moduletests/test_dust_modules.cpp b/iceoryx_dust/test/moduletests/test_dust_modules.cpp deleted file mode 100644 index 1091df15b9..0000000000 --- a/iceoryx_dust/test/moduletests/test_dust_modules.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// Copyright (c) 2021 - 2022 by Apex.AI inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "iceoryx_hoofs/testing/testing_logger.hpp" - -#include "test.hpp" - -using namespace ::testing; -using ::testing::_; - -int main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - - iox::testing::TestingLogger::init(); - - return RUN_ALL_TESTS(); -} diff --git a/iceoryx_dust/test/test.hpp b/iceoryx_dust/test/test.hpp deleted file mode 100644 index e7fea81ebe..0000000000 --- a/iceoryx_dust/test/test.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_DUST_TEST_TEST_HPP -#define IOX_DUST_TEST_TEST_HPP - -#include -#include -#include -#include - -#endif // IOX_DUST_TEST_TEST_HPP diff --git a/iceoryx_examples/complexdata/CMakeLists.txt b/iceoryx_examples/complexdata/CMakeLists.txt index 3efb25ed63..0b950898c0 100644 --- a/iceoryx_examples/complexdata/CMakeLists.txt +++ b/iceoryx_examples/complexdata/CMakeLists.txt @@ -21,7 +21,6 @@ project(example_complexdata) include(GNUInstallDirs) find_package(iceoryx_platform REQUIRED) -find_package(iceoryx_dust CONFIG REQUIRED) find_package(iceoryx_posh CONFIG REQUIRED) find_package(iceoryx_hoofs CONFIG REQUIRED) diff --git a/iceoryx_examples/iceperf/CMakeLists.txt b/iceoryx_examples/iceperf/CMakeLists.txt index df2fef10a9..1e04c2c00a 100644 --- a/iceoryx_examples/iceperf/CMakeLists.txt +++ b/iceoryx_examples/iceperf/CMakeLists.txt @@ -25,7 +25,6 @@ find_package(iceoryx_platform REQUIRED) find_package(iceoryx_posh CONFIG REQUIRED) find_package(iceoryx_binding_c CONFIG REQUIRED) find_package(iceoryx_hoofs CONFIG REQUIRED) -find_package(iceoryx_dust CONFIG REQUIRED) include(IceoryxPackageHelper) include(IceoryxPlatform) diff --git a/iceoryx_integrationtest/package.xml b/iceoryx_integrationtest/package.xml index 0a6058cc6b..da87e3fb5e 100644 --- a/iceoryx_integrationtest/package.xml +++ b/iceoryx_integrationtest/package.xml @@ -19,7 +19,6 @@ iceoryx_binding_c iceoryx_posh iceoryx_hoofs - iceoryx_dust example_callbacks example_callbacks_in_c diff --git a/iceoryx_meta/CMakeLists.txt b/iceoryx_meta/CMakeLists.txt index 8157b02242..0232ca5ab4 100644 --- a/iceoryx_meta/CMakeLists.txt +++ b/iceoryx_meta/CMakeLists.txt @@ -38,7 +38,6 @@ endif() # ===== Core add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_platform ${CMAKE_BINARY_DIR}/platform) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_hoofs ${CMAKE_BINARY_DIR}/hoofs) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_dust ${CMAKE_BINARY_DIR}/dust) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_posh ${CMAKE_BINARY_DIR}/posh) # ===== Doxygen example diff --git a/iceoryx_meta/tests.cmake b/iceoryx_meta/tests.cmake index c801e6a998..8ba9982283 100644 --- a/iceoryx_meta/tests.cmake +++ b/iceoryx_meta/tests.cmake @@ -19,7 +19,7 @@ if (BUILD_TEST) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/googletest ${CMAKE_BINARY_DIR}/dependencies/googletest/prebuild) ### create component list - set(COMPONENTS "hoofs" "dust" "posh") + set(COMPONENTS "hoofs" "posh") ### possible place for more extensions if (BINDING_C) diff --git a/iceoryx_posh/BUILD.bazel b/iceoryx_posh/BUILD.bazel index ef384cba34..2adf2ceb41 100644 --- a/iceoryx_posh/BUILD.bazel +++ b/iceoryx_posh/BUILD.bazel @@ -120,7 +120,6 @@ cc_library( strip_include_prefix = "include", visibility = ["//visibility:public"], deps = [ - "//iceoryx_dust", "//iceoryx_hoofs", ], ) diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt index c500b11dbc..d0d0ffc7af 100644 --- a/iceoryx_posh/CMakeLists.txt +++ b/iceoryx_posh/CMakeLists.txt @@ -23,7 +23,6 @@ project(iceoryx_posh VERSION ${IOX_VERSION_STRING}) find_package(Threads REQUIRED) find_package(iceoryx_platform REQUIRED) find_package(iceoryx_hoofs REQUIRED) -find_package(iceoryx_dust REQUIRED) option(DOWNLOAD_TOML_LIB "Download cpptoml via the CMake ExternalProject module" ON) option(TOML_CONFIG "TOML support for RouDi with dynamic configuration" ON) @@ -90,7 +89,6 @@ iox_add_library( source/version source/runtime PUBLIC_LIBS iceoryx_hoofs::iceoryx_hoofs - iceoryx_dust::iceoryx_dust PRIVATE_LIBS ${CMAKE_THREAD_LIBS_INIT} PRIVATE_LIBS_LINUX rt FILES diff --git a/iceoryx_posh/cmake/Config.cmake.in b/iceoryx_posh/cmake/Config.cmake.in index e0075e2102..418730fe0b 100644 --- a/iceoryx_posh/cmake/Config.cmake.in +++ b/iceoryx_posh/cmake/Config.cmake.in @@ -21,7 +21,6 @@ include(CMakeFindDependencyMacro) find_dependency(iceoryx_platform) find_dependency(iceoryx_hoofs) -find_dependency(iceoryx_dust) include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") list(APPEND CMAKE_MODULE_PATH "@DESTINATION_CONFIGDIR@") diff --git a/iceoryx_posh/package.xml b/iceoryx_posh/package.xml index cd1adc64b3..03f7c812ad 100644 --- a/iceoryx_posh/package.xml +++ b/iceoryx_posh/package.xml @@ -14,7 +14,6 @@ git iceoryx_hoofs - iceoryx_dust doxygen From ab5f47db67249d305027d746a13d6e45c1f7cb60 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 18:52:51 +0100 Subject: [PATCH 12/18] iox-#2130 Revert from 'function_ref' to 'function' --- iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp | 2 +- iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp | 2 +- iceoryx_hoofs/cli/include/iox/cli_definition.hpp | 2 +- iceoryx_hoofs/cli/source/option_definition.cpp | 2 +- iceoryx_hoofs/cli/source/option_manager.cpp | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp index 1b9cfdf37a..08b900b5d7 100644 --- a/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp @@ -40,7 +40,7 @@ class OptionDefinition /// defined std::quick_exit(EXIT_FAILURE) is called explicit OptionDefinition( const OptionDescription_t& programDescription, - const function_ref onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) noexcept; + const function& onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) noexcept; /// @brief Adds a command line switch argument /// Calls the onFailureCallback when the option was already added or the shortOption and longOption are diff --git a/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp b/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp index 38956a7a70..33a3b9acd8 100644 --- a/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option_manager.hpp @@ -40,7 +40,7 @@ class OptionManager /// @param[in] programDescription the description of the application /// @param[in] onFailureCallback callback which is called when a syntax error occurs, a required option is missing /// or the wrong type as argument value is provided - OptionManager(const OptionDescription_t& programDescription, const function_ref onFailureCallback); + OptionManager(const OptionDescription_t& programDescription, const function& onFailureCallback); /// @brief Defines a new option /// @param[in] referenceToMember an uninitialized piece of memory where later the content is stored when diff --git a/iceoryx_hoofs/cli/include/iox/cli_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp index 7b7d89b6da..bd106ce2ce 100644 --- a/iceoryx_hoofs/cli/include/iox/cli_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp @@ -113,7 +113,7 @@ char** argv, \ const iox::cli::OptionDescription_t& programDescription, \ const uint64_t argcOffset = 1U, \ - const ::iox::function_ref onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) \ + const ::iox::function& onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) \ { \ ::iox::cli::OptionManager optionManager(programDescription, onFailureCallback); \ return Name(optionManager, argc, argv, argcOffset); \ diff --git a/iceoryx_hoofs/cli/source/option_definition.cpp b/iceoryx_hoofs/cli/source/option_definition.cpp index 7ab3ee439d..c728b0cd5b 100644 --- a/iceoryx_hoofs/cli/source/option_definition.cpp +++ b/iceoryx_hoofs/cli/source/option_definition.cpp @@ -22,7 +22,7 @@ namespace iox namespace cli { OptionDefinition::OptionDefinition(const OptionDescription_t& programDescription, - const function_ref onFailureCallback) noexcept + const function& onFailureCallback) noexcept : m_programDescription{programDescription} , m_onFailureCallback{onFailureCallback} { diff --git a/iceoryx_hoofs/cli/source/option_manager.cpp b/iceoryx_hoofs/cli/source/option_manager.cpp index b5f93a9395..142866ce1b 100644 --- a/iceoryx_hoofs/cli/source/option_manager.cpp +++ b/iceoryx_hoofs/cli/source/option_manager.cpp @@ -20,8 +20,7 @@ namespace iox { namespace cli { -OptionManager::OptionManager(const OptionDescription_t& programDescription, - const function_ref onFailureCallback) +OptionManager::OptionManager(const OptionDescription_t& programDescription, const function& onFailureCallback) : m_optionSet{programDescription, onFailureCallback} { } From 8c04f2b9d34e8bc12a6aac7284354a0b2491cac1 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 18:57:37 +0100 Subject: [PATCH 13/18] iox-#2130 Add missing include --- iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp b/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp index ffbd23fe40..5a43bf0995 100644 --- a/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp +++ b/iceoryx_hoofs/test/moduletests/test_vocabulary_span.cpp @@ -18,6 +18,7 @@ #include "iox/vector.hpp" #include "test.hpp" +#include #include namespace From 10d4de6b2de7697247d22099658b39638e36c4e5 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 19:01:02 +0100 Subject: [PATCH 14/18] iox-#2130 Remove dust test from cirrus-ci --- .cirrus.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.cirrus.yaml b/.cirrus.yaml index cdbc44e428..2638c532c9 100644 --- a/.cirrus.yaml +++ b/.cirrus.yaml @@ -84,8 +84,6 @@ iox_prepare_test_binaries_for_cache_template: &IOX_PREPARE_TEST_BINARIES_FOR_CAC - mv build/hoofs/test/hoofs_mocktests iox-tests-bin - mv build/hoofs/test/hoofs_moduletests iox-tests-bin - mv build/hoofs/test/hoofs_integrationtests iox-tests-bin - - mv build/dust/test/dust_moduletests iox-tests-bin - - mv build/dust/test/dust_integrationtests iox-tests-bin - mv build/posh/test/posh_moduletests iox-tests-bin - mv build/posh/test/posh_integrationtests iox-tests-bin - mv build/binding_c/test/binding_c_moduletests iox-tests-bin @@ -95,8 +93,6 @@ iox_run_tests_template: &IOX_RUN_TESTS - ./hoofs_mocktests - ./hoofs_moduletests - ./hoofs_integrationtests - - ./dust_moduletests - - ./dust_integrationtests - ./posh_moduletests - ./posh_integrationtests - ./binding_c_moduletests From c3d6a1c071a7595f8a6751091980f8e65f73eaf3 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 19:14:52 +0100 Subject: [PATCH 15/18] iox-#2130 Use 'std::abort' instead of 'std::quick_exit' --- iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp | 4 ++-- iceoryx_hoofs/cli/include/iox/cli_definition.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp index 08b900b5d7..238b658190 100644 --- a/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli/option_definition.hpp @@ -37,10 +37,10 @@ class OptionDefinition /// @brief The constructor. /// @param[in] programDescription The description to the program. Will be printed in the help. /// @param[in] onFailureCallback callback which is called when parse fails, if nothing is - /// defined std::quick_exit(EXIT_FAILURE) is called + /// defined std::abort() is called explicit OptionDefinition( const OptionDescription_t& programDescription, - const function& onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) noexcept; + const function& onFailureCallback = [] { std::abort(); }) noexcept; /// @brief Adds a command line switch argument /// Calls the onFailureCallback when the option was already added or the shortOption and longOption are diff --git a/iceoryx_hoofs/cli/include/iox/cli_definition.hpp b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp index bd106ce2ce..5dce7f34bf 100644 --- a/iceoryx_hoofs/cli/include/iox/cli_definition.hpp +++ b/iceoryx_hoofs/cli/include/iox/cli_definition.hpp @@ -113,7 +113,7 @@ char** argv, \ const iox::cli::OptionDescription_t& programDescription, \ const uint64_t argcOffset = 1U, \ - const ::iox::function& onFailureCallback = [] { std::quick_exit(EXIT_FAILURE); }) \ + const ::iox::function& onFailureCallback = [] { std::abort(); }) \ { \ ::iox::cli::OptionManager optionManager(programDescription, onFailureCallback); \ return Name(optionManager, argc, argv, argcOffset); \ From 0f5b264cb1fe7bc20482ae31a35b09029bcd991a Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 20:48:12 +0100 Subject: [PATCH 16/18] iox-#2130 Fix bazel build --- iceoryx_hoofs/BUILD.bazel | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel index d6a0c4aec9..96ce266a5a 100644 --- a/iceoryx_hoofs/BUILD.bazel +++ b/iceoryx_hoofs/BUILD.bazel @@ -23,6 +23,8 @@ configure_file( src = "cmake/iceoryx_hoofs_deployment.hpp.in", out = "generated/include/iox/iceoryx_hoofs_deployment.hpp", config = { + "IOX_MAX_NAMED_PIPE_MESSAGE_SIZE": "4096", + "IOX_MAX_NAMED_PIPE_NUMBER_OF_MESSAGES": "10", # FIXME: for values see "iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake" ... for now some nice defaults "IOX_MINIMAL_LOG_LEVEL": "TRACE", }, @@ -57,7 +59,7 @@ cc_library( "utility/source/*.cpp", "vocabulary/source/**/*.cpp", ]), - hdrs = glob(["include/**"]) + glob(["legacy/**"]) + glob(["cli/**"]) + glob(["memory/**"]) + glob(["container/**"]) + glob(["vocabulary/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["primitives/**"]) + glob(["posix/**"]) + glob(["design/**"]) + glob(["buffer/**"]) + glob(["filesystem/**"]) + glob(["functional/**"]) + glob(["reporting/**"]) + [ + hdrs = glob(["buffer/**"]) + glob(["cli/**"]) + glob(["container/**"]) + glob(["design/**"]) + glob(["filesystem/**"]) + glob(["functional/**"]) + glob(["include/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["posix/**"]) + glob(["primitives/**"]) + glob(["reporting/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["vocabulary/**"]) + [ ":iceoryx_hoofs_deployment_hpp", ":iceoryx_versions_h", ], From 9ff95975286cb6c167bf41bed794cbf3f651948f Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 21:22:29 +0100 Subject: [PATCH 17/18] iox-#2130 Pin bazel to a fixed version --- .bazelversion | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .bazelversion diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000000..ae27f16496 --- /dev/null +++ b/.bazelversion @@ -0,0 +1,2 @@ +6.4.0 +# NOTE: Bazel 7.0 errors out on 'buildifier_lint_check' with a hint to 'go_register_toolchains' in 'setup.bzl' From 7095220692a227a9fa77cda852d88772395610c7 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 12 Dec 2023 21:29:18 +0100 Subject: [PATCH 18/18] iox-#2130 Remove debug code --- iceoryx_hoofs/cli/include/iox/cli/option_manager.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl b/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl index 9fffb2e5e2..1ddb1a929f 100644 --- a/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl +++ b/iceoryx_hoofs/cli/include/iox/cli/option_manager.inl @@ -16,7 +16,7 @@ #ifndef IOX_HOOFS_CLI_OPTION_MANAGER_INL #define IOX_HOOFS_CLI_OPTION_MANAGER_INL -#pragma once + #include "iox/cli/option_manager.hpp" namespace iox