Skip to content

Commit

Permalink
iox-eclipse-iceoryx#743 more fine grained IOX_NO_DISCARD feature sele…
Browse files Browse the repository at this point in the history
…ction

Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff committed Apr 20, 2021
1 parent 79378cd commit 612d5de
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions iceoryx_utils/include/iceoryx_utils/cxx/attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ namespace cxx
// [[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)
/// activate keywords for gcc>=5 or clang>=4
#if (defined(__GNUC__) && __GNUC__ >= 5) || (defined(__clang__) && __clang_major__ >= 4)
#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]] // NOLINT
#else
// On WIN32 we are using C++17 which makes the keyword [[nodiscard]] available
#if defined(_WIN32)
// On WIN32 we are using C++17 which makes the keyword [[nodiscard]] available
#define IOX_NO_DISCARD [[nodiscard]] // NOLINT
// on an unknown platform we use for now nothing since we do not know what is supported there
#elif defined(__APPLE__) && defined(__clang__)
// On APPLE we are using C++17 which makes the keyword [[nodiscard]] available
#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]] // NOLINT
#elif (defined(__clang__) && __clang_major__ >= 4)
#define IOX_NO_DISCARD [[gnu::warn_unused]] // NOLINT
#elif (defined(__GNUC__) && __GNUC__ >= 5)
#define IOX_NO_DISCARD [[nodiscard, gnu::warn_unused]] // NOLINT
#else
// on an unknown platform we use for now nothing since we do not know what is supported there
#define IOX_NO_DISCARD
#endif
#endif
Expand Down

0 comments on commit 612d5de

Please sign in to comment.