IDS peak IPL v1.17.2
Loading...
Searching...
No Matches
peak_common_defines.h
Go to the documentation of this file.
1
10
11#pragma once
12
13// clang-format off
14#if defined(__cplusplus) && ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
15// clang-format on
24# define PEAK_COMMON_NO_DISCARD [[nodiscard]]
25
34# define PEAK_COMMON_MAYBE_UNUSED [[maybe_unused]]
35
36#else
37
38# ifdef __has_c_attribute
39# define PEAK_COMMON_has_c_attribute(x) __has_c_attribute(x)
40# else
41# define PEAK_COMMON_has_c_attribute(x) 0
42# endif
43
44# if PEAK_COMMON_has_c_attribute(nodiscard)
53# define PEAK_COMMON_NO_DISCARD [[nodiscard]]
54
55# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
64# define PEAK_COMMON_NO_DISCARD __attribute__((warn_unused_result))
65
66# elif defined(_MSC_VER)
75# define PEAK_COMMON_NO_DISCARD _Check_return_
76
77# else
86# define PEAK_COMMON_NO_DISCARD
87
88# endif
89
90# if PEAK_COMMON_has_c_attribute(maybe_unused)
99# define PEAK_COMMON_MAYBE_UNUSED [[maybe_unused]]
100
101# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
110# define PEAK_COMMON_MAYBE_UNUSED __attribute__((unused))
111
112# else
121# define PEAK_COMMON_MAYBE_UNUSED
122
123# endif
124
125#endif /* language mode */