iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
attributes.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  iox2
 
namespace  iox2::bb
 
namespace  iox2::bb::detail
 

Macros

#define IOX2_DISCARD_RESULT(expr)   ::iox2::bb::detail::iox2_discard_result_impl(expr)
 if a function has a return value which you do not want to use then you can wrap the function with that macro. Purpose is to suppress the unused compiler warning by adding an attribute to the return value
 
#define IOX2_CXX_STANDARD_VERSION   __cplusplus
 IOX2_CXX_STANDARD_VERSION resolves the effective C++ language level.
 
#define IOX2_NO_DISCARD
 IOX2_NO_DISCARD adds the [[nodiscard]] keyword if it is available for the current compiler.
 
#define IOX2_FALLTHROUGH
 IOX2_FALLTHROUGH adds the [[fallthrough]] keyword when it is available for the current compiler.
 
#define IOX2_MAYBE_UNUSED
 IOX2_MAYBE_UNUSED adds the [[gnu::unused]] attribute when it is available for the current compiler or uses C++17's 'maybe_unused'.
 
#define IOX2_HAS_CONSTEXPR_DTOR   0
 IOX2_CONSTEXPR_DTOR adds constexpr to destructors when the active compiler mode supports it.
 
#define IOX2_CONSTEXPR_DTOR
 

Functions

template<typename T >
void iox2::bb::detail::iox2_discard_result_impl (T &&) noexcept
 

Macro Definition Documentation

◆ IOX2_CONSTEXPR_DTOR

#define IOX2_CONSTEXPR_DTOR

Definition at line 94 of file attributes.hpp.

◆ IOX2_CXX_STANDARD_VERSION

#define IOX2_CXX_STANDARD_VERSION   __cplusplus

IOX2_CXX_STANDARD_VERSION resolves the effective C++ language level.

Note
MSVC historically reports an outdated __cplusplus value unless /Zc:__cplusplus is enabled, therefore _MSVC_LANG must be preferred when it reports a newer standard level.

Definition at line 51 of file attributes.hpp.

◆ IOX2_DISCARD_RESULT

#define IOX2_DISCARD_RESULT (   expr)    ::iox2::bb::detail::iox2_discard_result_impl(expr)

if a function has a return value which you do not want to use then you can wrap the function with that macro. Purpose is to suppress the unused compiler warning by adding an attribute to the return value

Parameters
[in]exprname of the function where the return value is not used.
uint32_t foo();
IOX2_DISCARD_RESULT(foo()); // suppress compiler warning for unused return value
#define IOX2_DISCARD_RESULT(expr)
if a function has a return value which you do not want to use then you can wrap the function with tha...

Definition at line 43 of file attributes.hpp.

◆ IOX2_FALLTHROUGH

#define IOX2_FALLTHROUGH

IOX2_FALLTHROUGH adds the [[fallthrough]] keyword when it is available for the current compiler.

Note
[[fallthrough]] supported since clang 3.9 (https://clang.llvm.org/cxx_status.html) activate keywords for gcc>=7 or clang>=4

Definition at line 74 of file attributes.hpp.

◆ IOX2_HAS_CONSTEXPR_DTOR

#define IOX2_HAS_CONSTEXPR_DTOR   0

IOX2_CONSTEXPR_DTOR adds constexpr to destructors when the active compiler mode supports it.

Note
constexpr destructors are only supported since C++20.

Definition at line 93 of file attributes.hpp.

◆ IOX2_MAYBE_UNUSED

#define IOX2_MAYBE_UNUSED

IOX2_MAYBE_UNUSED adds the [[gnu::unused]] attribute when it is available for the current compiler or uses C++17's 'maybe_unused'.

Definition at line 84 of file attributes.hpp.

◆ IOX2_NO_DISCARD

#define IOX2_NO_DISCARD

IOX2_NO_DISCARD adds the [[nodiscard]] keyword if it is available for the current compiler.

Definition at line 59 of file attributes.hpp.