From dc3930a8a774d4f0fbc9d55ba12b6eaee6e54b80 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 17 Nov 2023 20:21:06 +0100 Subject: [PATCH] iox-#2066 Remove iceoryx_platform/attributes.hpp --- .../include/iceoryx_hoofs/cxx/attributes.hpp | 7 +++ .../posix/filesystem/source/file.cpp | 2 +- .../primitives/include/iox/attributes.hpp | 8 ++- .../include/iceoryx_platform/attributes.hpp | 52 ------------------- .../include/iceoryx_platform/attributes.hpp | 51 ------------------ .../include/iceoryx_platform/attributes.hpp | 26 ---------- .../include/iceoryx_platform/attributes.hpp | 39 -------------- .../include/iceoryx_platform/attributes.hpp | 26 ---------- .../include/iceoryx_platform/attributes.hpp | 26 ---------- 9 files changed, 14 insertions(+), 223 deletions(-) delete mode 100644 iceoryx_platform/freertos/include/iceoryx_platform/attributes.hpp delete mode 100644 iceoryx_platform/linux/include/iceoryx_platform/attributes.hpp delete mode 100644 iceoryx_platform/mac/include/iceoryx_platform/attributes.hpp delete mode 100644 iceoryx_platform/qnx/include/iceoryx_platform/attributes.hpp delete mode 100644 iceoryx_platform/unix/include/iceoryx_platform/attributes.hpp delete mode 100644 iceoryx_platform/win/include/iceoryx_platform/attributes.hpp diff --git a/iceoryx_hoofs/legacy/include/iceoryx_hoofs/cxx/attributes.hpp b/iceoryx_hoofs/legacy/include/iceoryx_hoofs/cxx/attributes.hpp index 95ce32b80a4..b070ba5c898 100644 --- a/iceoryx_hoofs/legacy/include/iceoryx_hoofs/cxx/attributes.hpp +++ b/iceoryx_hoofs/legacy/include/iceoryx_hoofs/cxx/attributes.hpp @@ -33,6 +33,13 @@ namespace internal /// @deprecated use 'iox::internal::IOX_DISCARD_RESULT_IMPL' instead of 'iox::cxx::internal::IOX_DISCARD_RESULT_IMPL' using iox::internal::IOX_DISCARD_RESULT_IMPL; } // namespace internal + +// #define IOX_NO_DISCARD [[nodiscard]] + +// #define IOX_FALLTHROUGH [[fallthrough]] + +// #define IOX_MAYBE_UNUSED [[maybe_unused]] + } // namespace cxx } // namespace iox diff --git a/iceoryx_hoofs/posix/filesystem/source/file.cpp b/iceoryx_hoofs/posix/filesystem/source/file.cpp index 74baedc1a73..763789c0ff1 100644 --- a/iceoryx_hoofs/posix/filesystem/source/file.cpp +++ b/iceoryx_hoofs/posix/filesystem/source/file.cpp @@ -16,10 +16,10 @@ #include "iox/file.hpp" #include "iceoryx_hoofs/posix_wrapper/posix_call.hpp" -#include "iceoryx_platform/attributes.hpp" #include "iceoryx_platform/errno.hpp" #include "iceoryx_platform/fcntl.hpp" #include "iceoryx_platform/stdio.hpp" +#include "iox/attributes.hpp" #include "iox/filesystem.hpp" namespace iox diff --git a/iceoryx_hoofs/primitives/include/iox/attributes.hpp b/iceoryx_hoofs/primitives/include/iox/attributes.hpp index a07c385e321..6f65c35af96 100644 --- a/iceoryx_hoofs/primitives/include/iox/attributes.hpp +++ b/iceoryx_hoofs/primitives/include/iox/attributes.hpp @@ -17,8 +17,6 @@ #ifndef IOX_HOOFS_PRIMITIVES_ATTRIBUTES_HPP #define IOX_HOOFS_PRIMITIVES_ATTRIBUTES_HPP -#include "iceoryx_platform/attributes.hpp" - namespace iox { namespace internal @@ -47,6 +45,12 @@ inline void IOX_DISCARD_RESULT_IMPL(T&&) noexcept /// @endcode #define IOX_DISCARD_RESULT(expr) ::iox::internal::IOX_DISCARD_RESULT_IMPL(expr) +#define IOX_NO_DISCARD [[nodiscard]] + +#define IOX_FALLTHROUGH [[fallthrough]] + +#define IOX_MAYBE_UNUSED [[maybe_unused]] + // NOLINTEND(cppcoreguidelines-macro-usage) #endif diff --git a/iceoryx_platform/freertos/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/freertos/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index caf07c44a07..00000000000 --- a/iceoryx_platform/freertos/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2021 - 2022 by Apex.AI Inc. All rights reserved. -// Copyright (c) 2023 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_HOOFS_FREERTOS_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_FREERTOS_PLATFORM_ATTRIBUTES_HPP - -/// @brief IOX_NO_DISCARD adds the [[nodiscard]] keyword if it is available for the current compiler. - -#if __cplusplus >= 201703L -#define IOX_NO_DISCARD [[nodiscard]] -#else -#define IOX_NO_DISCARD -#endif - -/// @brief IOX_FALLTHROUGH adds the [[fallthrough]] keyword when it is available for the current compiler. -/// @note -// [[fallthrough]] supported since gcc 7 (https://gcc.gnu.org/projects/cxx-status.html) -/// [[fallthrough]] supported since clang 3.9 (https://clang.llvm.org/cxx_status.html) -/// activate keywords for gcc>=7 or clang>=4 - -#if __cplusplus >= 201703L -// clang prints a warning therefore we exclude it here -#define IOX_FALLTHROUGH [[fallthrough]] -#elif (defined(__GNUC__) && (__GNUC__ >= 7)) && !defined(__clang__) -#define IOX_FALLTHROUGH [[gnu::fallthrough]] -#else -#define IOX_FALLTHROUGH -#endif - -/// @brief IOX_MAYBE_UNUSED adds the [[gnu::unused]] attribute when it is available for the current -/// compiler or uses C++17's 'maybe_unused'. -#if __cplusplus >= 201703L -#define IOX_MAYBE_UNUSED [[maybe_unused]] -#else -#define IOX_MAYBE_UNUSED [[gnu::unused]] -#endif - -#endif // IOX_HOOFS_FREERTOS_PLATFORM_ATTRIBUTES_HPP diff --git a/iceoryx_platform/linux/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/linux/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index 9c1d09821b6..00000000000 --- a/iceoryx_platform/linux/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// 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 - -#ifndef IOX_HOOFS_LINUX_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_LINUX_PLATFORM_ATTRIBUTES_HPP - -/// @brief IOX_NO_DISCARD adds the [[nodiscard]] keyword if it is available for the current compiler. - -#if __cplusplus >= 201703L -#define IOX_NO_DISCARD [[nodiscard]] -#else -#define IOX_NO_DISCARD -#endif - -/// @brief IOX_FALLTHROUGH adds the [[fallthrough]] keyword when it is available for the current compiler. -/// @note -// [[fallthrough]] supported since gcc 7 (https://gcc.gnu.org/projects/cxx-status.html) -/// [[fallthrough]] supported since clang 3.9 (https://clang.llvm.org/cxx_status.html) -/// activate keywords for gcc>=7 or clang>=4 - -#if __cplusplus >= 201703L -// clang prints a warning therefore we exclude it here -#define IOX_FALLTHROUGH [[fallthrough]] -#elif (defined(__GNUC__) && (__GNUC__ >= 7)) && !defined(__clang__) -#define IOX_FALLTHROUGH [[gnu::fallthrough]] -#else -#define IOX_FALLTHROUGH -#endif - -/// @brief IOX_MAYBE_UNUSED adds the [[gnu::unused]] attribute when it is available for the current -/// compiler or uses C++17's 'maybe_unused'. -#if __cplusplus >= 201703L -#define IOX_MAYBE_UNUSED [[maybe_unused]] -#else -#define IOX_MAYBE_UNUSED [[gnu::unused]] -#endif - -#endif // IOX_HOOFS_LINUX_PLATFORM_ATTRIBUTES_HPP diff --git a/iceoryx_platform/mac/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/mac/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index 056b9cad7d3..00000000000 --- a/iceoryx_platform/mac/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// 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 - -#ifndef IOX_HOOFS_MAC_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_MAC_PLATFORM_ATTRIBUTES_HPP - -#define IOX_NO_DISCARD [[nodiscard]] - -#define IOX_FALLTHROUGH [[fallthrough]] - -#define IOX_MAYBE_UNUSED [[maybe_unused]] - -#endif // IOX_HOOFS_MAC_PLATFORM_ATTRIBUTES_HPP diff --git a/iceoryx_platform/qnx/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/qnx/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index 6129d10ccf8..00000000000 --- a/iceoryx_platform/qnx/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// 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 - -#ifndef IOX_HOOFS_QNX_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_QNX_PLATFORM_ATTRIBUTES_HPP - -/// @todo iox-#638 Are any of the below flags available with C++14 on QCC? -#if __cplusplus >= 201703L -#define IOX_NO_DISCARD [[nodiscard]] -#else -#define IOX_NO_DISCARD -#endif - -#if __cplusplus >= 201703L -#define IOX_FALLTHROUGH [[fallthrough]] -#else -#define IOX_FALLTHROUGH -#endif - -#if __cplusplus >= 201703L -#define IOX_MAYBE_UNUSED [[maybe_unused]] -#else -#define IOX_MAYBE_UNUSED [[gnu::unused]] -#endif - -#endif // IOX_HOOFS_QNX_PLATFORM_ATTRIBUTES_HPP diff --git a/iceoryx_platform/unix/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/unix/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index 1e011f64420..00000000000 --- a/iceoryx_platform/unix/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// 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 - -#ifndef IOX_HOOFS_UNIX_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_UNIX_PLATFORM_ATTRIBUTES_HPP - -#define IOX_NO_DISCARD [[nodiscard]] - -#define IOX_FALLTHROUGH [[fallthrough]] - -#define IOX_MAYBE_UNUSED [[maybe_unused]] - -#endif // IOX_HOOFS_UNIX_PLATFORM_ATTRIBUTES_HPP diff --git a/iceoryx_platform/win/include/iceoryx_platform/attributes.hpp b/iceoryx_platform/win/include/iceoryx_platform/attributes.hpp deleted file mode 100644 index 681b82f6e11..00000000000 --- a/iceoryx_platform/win/include/iceoryx_platform/attributes.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// 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 - -#ifndef IOX_HOOFS_WIN_PLATFORM_ATTRIBUTES_HPP -#define IOX_HOOFS_WIN_PLATFORM_ATTRIBUTES_HPP - -#define IOX_NO_DISCARD [[nodiscard]] - -#define IOX_FALLTHROUGH [[fallthrough]] - -#define IOX_MAYBE_UNUSED [[maybe_unused]] - -#endif // IOX_HOOFS_WIN_PLATFORM_ATTRIBUTES_HPP