iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
attributes.hpp
Go to the documentation of this file.
1// Copyright (c) 2021-2023 by Apex.AI Inc. All rights reserved.
2// Copyright (c) 2025 Contributors to the Eclipse Foundation
3//
4// See the NOTICE file(s) distributed with this work for additional
5// information regarding copyright ownership.
6//
7// This program and the accompanying materials are made available under the
8// terms of the Apache Software License 2.0 which is available at
9// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
10// which is available at https://opensource.org/licenses/MIT.
11//
12// SPDX-License-Identifier: Apache-2.0 OR MIT
13
14#ifndef IOX2_BB_DETAIL_ATTRIBUTES_HPP
15#define IOX2_BB_DETAIL_ATTRIBUTES_HPP
16
17namespace iox2 {
18namespace bb {
19namespace detail {
23template <typename T>
24// AXIVION Next Construct AutosarC++19_03-M0.1.8 : No side effects are the intended behavior of the function
25// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) intended for this function
26inline void iox2_discard_result_impl(T&& /* unused */) noexcept {
27}
28} // namespace detail
29} // namespace bb
30} // namespace iox2
31
32// AXIVION Next Construct AutosarC++19_03-A16.0.1 : Aliasing of fully qualified templated function.
33// Improves readability. No risks apparent.
34// NOLINTJUSTIFICATION cannot be implemented with a function, required as inline code
35// NOLINTBEGIN(cppcoreguidelines-macro-usage)
43#define IOX2_DISCARD_RESULT(expr) ::iox2::bb::detail::iox2_discard_result_impl(expr)
44
48#if defined(_MSVC_LANG) && (_MSVC_LANG > __cplusplus)
49#define IOX2_CXX_STANDARD_VERSION _MSVC_LANG
50#else
51#define IOX2_CXX_STANDARD_VERSION __cplusplus
52#endif
53
55
56#if IOX2_CXX_STANDARD_VERSION >= 201703L
57#define IOX2_NO_DISCARD [[nodiscard]]
58#else
59#define IOX2_NO_DISCARD
60#endif
61
64// [[fallthrough]] supported since gcc 7 (https://gcc.gnu.org/projects/cxx-status.html)
67
68#if IOX2_CXX_STANDARD_VERSION >= 201703L
69// clang prints a warning therefore we exclude it here
70#define IOX2_FALLTHROUGH [[fallthrough]]
71#elif (defined(__GNUC__) && (__GNUC__ >= 7)) || defined(__clang__)
72#define IOX2_FALLTHROUGH [[gnu::fallthrough]]
73#else
74#define IOX2_FALLTHROUGH
75#endif
76
79#if IOX2_CXX_STANDARD_VERSION >= 201703L
80#define IOX2_MAYBE_UNUSED [[maybe_unused]]
81#elif (defined(__GNUC__) && (__GNUC__ >= 7)) || defined(__clang__)
82#define IOX2_MAYBE_UNUSED [[gnu::unused]]
83#else
84#define IOX2_MAYBE_UNUSED
85#endif
86
89#if IOX2_CXX_STANDARD_VERSION >= 202002L
90#define IOX2_HAS_CONSTEXPR_DTOR 1
91#define IOX2_CONSTEXPR_DTOR constexpr
92#else
93#define IOX2_HAS_CONSTEXPR_DTOR 0
94#define IOX2_CONSTEXPR_DTOR
95#endif
96
97// NOLINTEND(cppcoreguidelines-macro-usage)
98
99#endif // IOX2_BB_DETAIL_ATTRIBUTES_HPP
void iox2_discard_result_impl(T &&) noexcept