Skip to content

Commit 487e105

Browse files
committed
Improve maybe_unused definition
1 parent 2aa98c4 commit 487e105

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

include/boost/decimal/detail/config.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ typedef unsigned __int128 uint128_t;
172172

173173
#define BOOST_DECIMAL_PREVENT_MACRO_SUBSTITUTION
174174

175-
#if defined(___GNUC__) || defined(__clang__)
176-
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED __attribute__((__unused__))
175+
#if __has_cpp_attribute(maybe_unused)
176+
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED [[maybe_unused]]
177177
#else
178-
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED
178+
# if defined(___GNUC__) || defined(__clang__)
179+
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED __attribute__((__unused__))
180+
# elif defined(_MSC_VER)
181+
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED __pragma(warning(suppress: 4189))
182+
# else
183+
# define BOOST_DECIMAL_ATTRIBUTE_UNUSED
184+
# endif
179185
#endif
180186

181187
#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606L)

0 commit comments

Comments
 (0)