Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1726 Remove 'gnu::warn_unused' which doesn't do t…
Browse files Browse the repository at this point in the history
…he expected

Signed-off-by: Simon Hoinkis <[email protected]>
  • Loading branch information
mossmaurice committed Jan 16, 2023
1 parent f89ede6 commit 3b88b3c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
14 changes: 7 additions & 7 deletions iceoryx_platform/linux/include/iceoryx_platform/attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
#define IOX_HOOFS_LINUX_PLATFORM_ATTRIBUTES_HPP

/// @brief IOX_NO_DISCARD adds the [[nodiscard]] keyword if it is available for the current compiler.
/// @note
// [[nodiscard]], [[gnu::warn_unused]] supported since gcc 4.8 (https://gcc.gnu.org/projects/cxx-status.html)
/// [[nodiscard]], [[gnu::warn_unused]] supported since clang 3.9 (https://clang.llvm.org/cxx_status.html)

#if __cplusplus >= 201703L
#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]]
#define IOX_NO_DISCARD [[nodiscard]]
#else
#define IOX_NO_DISCARD [[gnu::warn_unused]]
#define IOX_NO_DISCARD
#endif

/// @brief IOX_FALLTHROUGH adds the [[fallthrough]] keyword when it is available for the current compiler.
Expand All @@ -44,8 +41,11 @@
#endif

/// @brief IOX_MAYBE_UNUSED adds the [[gnu::unused]] attribute when it is available for the current
/// compiler.
/// @note
/// 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef IOX_HOOFS_MAC_PLATFORM_ATTRIBUTES_HPP
#define IOX_HOOFS_MAC_PLATFORM_ATTRIBUTES_HPP

#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]]
#define IOX_NO_DISCARD [[nodiscard]]

#define IOX_FALLTHROUGH [[fallthrough]]

Expand Down
15 changes: 9 additions & 6 deletions iceoryx_platform/qnx/include/iceoryx_platform/attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
#ifndef IOX_HOOFS_QNX_PLATFORM_ATTRIBUTES_HPP
#define IOX_HOOFS_QNX_PLATFORM_ATTRIBUTES_HPP

/// @todo iox-#638
/// @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

/// @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)
#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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef IOX_HOOFS_UNIX_PLATFORM_ATTRIBUTES_HPP
#define IOX_HOOFS_UNIX_PLATFORM_ATTRIBUTES_HPP

#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]]
#define IOX_NO_DISCARD [[nodiscard]]

#define IOX_FALLTHROUGH [[fallthrough]]

Expand Down

0 comments on commit 3b88b3c

Please sign in to comment.