Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
nodiscard.hpp
Go to the documentation of this file.
1
// Copyright 2024, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_ATTRIBUTES_NODISCARD_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_ATTRIBUTES_NODISCARD_HPP_
7
8
// IWYU pragma: private, include "arene/base/compiler_support/attributes.hpp"
9
10
#
include
"arene/base/compiler_support/attributes/has_attribute.hpp"
11
12
// NOLINTBEGIN(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
13
// parasoft-begin-suppress AUTOSAR-A16_0_1-d-2 "Conditional defines permitted by A16-0-1 Permit #2"
14
// parasoft-begin-suppress AUTOSAR-A16_0_1-a-2 "Conditional defines permitted by A16-0-1 Permit #2"
15
16
/// @def ARENE_NODISCARD
17
/// @brief An alias for @c [[nodiscard]] , or a no-op if the attribute is not supported
18
19
// parasoft-begin-suppress AUTOSAR-M16_0_7-a-2 "False positive: not used as a macro"
20
#
if
defined
(
__clang__
)
&&
ARENE_HAS_STD_ATTRIBUTE
(
gnu
::
warn_unused_result
)
21
#
define
ARENE_NODISCARD
[
[
gnu
::
warn_unused_result
]
]
22
#
elif
ARENE_HAS_STD_ATTRIBUTE
(
nodiscard
)
>=
201603L
23
#
define
ARENE_NODISCARD
[
[
nodiscard
]
]
24
#
else
25
#
define
ARENE_NODISCARD
26
#
endif
27
// parasoft-end-suppress AUTOSAR-M16_0_7-a-2
28
29
/// @def ARENE_NODISCARD_WITH
30
/// @brief An alias for @c [[nodiscard(...)]] , or a no-op if the attribute is not supported
31
32
// parasoft-begin-suppress AUTOSAR-M16_0_7-a-2 "False positive: not used as a macro"
33
#
if
defined
(
__clang__
)
&&
ARENE_HAS_STD_ATTRIBUTE
(
gnu
::
warn_unused_result
)
>=
201907L
34
#
define
ARENE_NODISCARD_WITH
(
...
)
[
[
gnu
::
warn_unused_result
(
__VA_ARGS__
)
]
]
35
#
elif
ARENE_HAS_STD_ATTRIBUTE
(
nodiscard
)
>=
201907L
36
#
define
ARENE_NODISCARD_WITH
(
...
)
[
[
nodiscard
(
__VA_ARGS__
)
]
]
37
#
else
38
#
define
ARENE_NODISCARD_WITH
(
...
)
ARENE_NODISCARD
39
#
endif
40
// parasoft-end-suppress AUTOSAR-M16_0_7-a-2
41
42
// NOLINTEND(cppcoreguidelines-macro-usage) Explicitly providing compiler support macro functions
43
// parasoft-end-suppress AUTOSAR-A16_0_1-d-2
44
// parasoft-end-suppress AUTOSAR-A16_0_1-a-2
45
46
#
endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_ATTRIBUTES_NODISCARD_HPP_
ARENE_NODISCARD
#define ARENE_NODISCARD
An alias for [[nodiscard]] , or a no-op if the attribute is not supported.
Definition
nodiscard.hpp:25
arene
base
compiler_support
attributes
nodiscard.hpp
Generated by
1.13.2