diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 8726098fd8b..0330fd507b3 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -117,6 +117,7 @@ - Remove `algorithm::uniqueMergeSortedContainers` from `algorithm.hpp` - Move `std::string` conversion function to `iceoryx_dust` [\#1612](https://github.com/eclipse-iceoryx/iceoryx/issues/1612) - The posix call `unlink` is directly used in `UnixDomainSocket` [\#1622](https://github.com/eclipse-iceoryx/iceoryx/issues/1622) +- Make iox::byte_t a distinct type [\#1900](https://github.com/eclipse-iceoryx/iceoryx/issues/1900) **Workflow:** diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index 8dbf452a51f..a026df31f4e 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -83,7 +83,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an | class | internal | description | |:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`type_traits` | | Extended support for evaluating types on compile-time. | -|`types` | | Declares essential building block types like `byte_t`. | +|`types` | | Declares essential building block types like `byte`. | |`attributes` | | C++17 and C++20 attributes are sometimes available through compiler extensions. The attribute macros defined in here (like `IOX_FALLTHROUGH`, `IOX_MAYBE_UNUSED` ... ) make sure that we are able to use them if the compiler supports it. | |`algorithm` | | Implements `min` and `max` for an arbitrary number of values of the same type. For instance `min(1,2,3,4,5);` | |`size` | | Helper functions to determine the size in generic ways | diff --git a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp index cebba5c9eab..aa6165c40dc 100644 --- a/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp +++ b/iceoryx_hoofs/container/include/iox/uninitialized_array.hpp @@ -35,7 +35,7 @@ struct ZeroedBuffer { // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-M0.1.3 : required by low level UninitializedArray building block and encapsulated in abstraction, declaration of field in struct for usage elsewhere // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) - byte_t data[sizeof(ElementType)]; + byte data[sizeof(ElementType)]; }; // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-A1.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction, object size limit is not relevant for containers stored in shared memory. // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) @@ -52,7 +52,7 @@ struct NonZeroedBuffer { // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-M0.1.3 : required by low level UninitializedArray building block and encapsulated in abstraction, declaration of field in struct for usage elsewhere // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) - byte_t data[sizeof(ElementType)]; + byte data[sizeof(ElementType)]; }; // AXIVION Next Construct AutosarC++19_03-A18.1.1, AutosarC++19_03-A1.1.1 : required by low level UninitializedArray building block and encapsulated in abstraction, object size limit is not relevant for containers stored in shared memory // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.hpp index c8384e538f7..86f1f59e3e2 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.hpp @@ -156,7 +156,7 @@ class storable_function> final // AXIVION Next Construct AutosarC++19_03-A18.1.1 : safe access is guaranteed since the c-array is wrapped inside the storable_function // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays) - byte_t m_storage[Capacity]; // storage for the callable + byte m_storage[Capacity]; // storage for the callable void* m_callable{nullptr}; // pointer to stored type-erased callable ReturnType (*m_invoker)(void*, Args&&...){nullptr}; // indirection to invoke the stored callable, // nullptr if no callable is stored @@ -195,7 +195,7 @@ class storable_function> final static ReturnType invokeFreeFunction(void* callable, Args&&... args) noexcept; template - static constexpr void* safeAlign(byte_t* startAddress); + static constexpr void* safeAlign(byte* startAddress); }; /// @brief swap two storable functions diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.inl index cce7ed9c9f6..0a8055d8012 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/storable_function.inl @@ -174,7 +174,7 @@ inline void swap(storable_function& f, storable_function template -inline constexpr void* storable_function>::safeAlign(byte_t* startAddress) +inline constexpr void* storable_function>::safeAlign(byte* startAddress) { static_assert(is_storable(), "type does not fit into storage"); // NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast, performance-no-int-to-ptr) required for low level pointer alignment diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object.hpp index 49d7918b204..c903abbbf85 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object.hpp @@ -31,7 +31,6 @@ namespace iox { namespace posix { -using byte_t = uint8_t; enum class SharedMemoryObjectError { diff --git a/iceoryx_hoofs/legacy/include/iceoryx_hoofs/iceoryx_hoofs_types.hpp b/iceoryx_hoofs/legacy/include/iceoryx_hoofs/iceoryx_hoofs_types.hpp index fae7f5be7cb..dc02be9f5f8 100644 --- a/iceoryx_hoofs/legacy/include/iceoryx_hoofs/iceoryx_hoofs_types.hpp +++ b/iceoryx_hoofs/legacy/include/iceoryx_hoofs/iceoryx_hoofs_types.hpp @@ -25,8 +25,8 @@ namespace iox /// [[deprecated("Deprecated in 3.0, removed in 4.0, please include 'iox/iceoryx_hoofs_types.hpp' instead")]] namespace cxx { -/// @deprecated use `iox::byte_t` instead of `iox::cxx::byte_t` -using iox::byte_t; +/// @deprecated use `iox::byte` instead of `iox::cxx::byte_t` + } // namespace cxx namespace log { diff --git a/iceoryx_hoofs/primitives/include/iox/iceoryx_hoofs_types.hpp b/iceoryx_hoofs/primitives/include/iox/iceoryx_hoofs_types.hpp index d1fed5d69d5..6dd74778643 100644 --- a/iceoryx_hoofs/primitives/include/iox/iceoryx_hoofs_types.hpp +++ b/iceoryx_hoofs/primitives/include/iox/iceoryx_hoofs_types.hpp @@ -24,7 +24,10 @@ namespace iox { -using byte_t = uint8_t; + +enum class byte : uint8_t +{ +}; // AXIVION Next Construct AutosarC++19_03-M2.10.1 : log is a sensible namespace for a logger; furthermore it is in the // iox namespace and when used as function the compiler will complain diff --git a/iceoryx_hoofs/vocabulary/include/iox/detail/variant_internal.hpp b/iceoryx_hoofs/vocabulary/include/iox/detail/variant_internal.hpp index 63778e13f5e..27e6ca21581 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/detail/variant_internal.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/detail/variant_internal.hpp @@ -18,6 +18,7 @@ #define IOX_HOOFS_VOCABULARY_VARIANT_INTERNAL_HPP #include "iceoryx_hoofs/cxx/requires.hpp" +#include "iox/iceoryx_hoofs_types.hpp" #include #include @@ -52,7 +53,6 @@ struct is_in_place_type> : std::true_type { }; -using byte_t = uint8_t; template struct does_contain_type { diff --git a/iceoryx_hoofs/vocabulary/include/iox/optional.hpp b/iceoryx_hoofs/vocabulary/include/iox/optional.hpp index 3c9e1b7e7bf..bfdd7f1b7e1 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/optional.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/optional.hpp @@ -233,7 +233,7 @@ class optional final : public FunctionalInterface, T, void> // AXIVION Next Construct AutosarC++19_03-A18.1.1 : safe access is guaranteed since the array // is wrapped inside the optional // NOLINTNEXTLINE(hicpp-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays) - byte_t data[sizeof(T)]; + byte data[sizeof(T)]; }; element_t m_data; diff --git a/iceoryx_hoofs/vocabulary/include/iox/variant.hpp b/iceoryx_hoofs/vocabulary/include/iox/variant.hpp index 14e2ef8146c..1784b34ea27 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/variant.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/variant.hpp @@ -265,7 +265,7 @@ class variant final // AXIVION Next Construct AutosarC++19_03-M0.1.3 : data provides the actual storage and is accessed via m_storage since &m_storage.data = &m_storage // AXIVION Next Construct AutosarC++19_03-A18.1.1 : safe access is guaranteed since the c-array is wrapped inside the variant class // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays) - internal::byte_t data[TYPE_SIZE]; + iox::byte data[TYPE_SIZE]; }; storage_t m_storage{}; uint64_t m_type_index{INVALID_VARIANT_INDEX};