[libc++][NFC] Rename _LIBCPP_NODISCARD_ATTRIBUTE to _LIBCPP_NODISCARD
Differential Revision: https://reviews.llvm.org/D108940
This commit is contained in:
parent
e781e03e40
commit
928cad59c7
|
|
@ -1052,30 +1052,28 @@ typedef unsigned int char32_t;
|
||||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
|
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
|
|
||||||
// NODISCARD macros to the correct attribute.
|
|
||||||
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
|
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
|
||||||
# define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]]
|
# define _LIBCPP_NODISCARD [[nodiscard]]
|
||||||
#elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG)
|
#elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG)
|
||||||
# define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]]
|
# define _LIBCPP_NODISCARD [[clang::warn_unused_result]]
|
||||||
#else
|
#else
|
||||||
// We can't use GCC's [[gnu::warn_unused_result]] and
|
// We can't use GCC's [[gnu::warn_unused_result]] and
|
||||||
// __attribute__((warn_unused_result)), because GCC does not silence them via
|
// __attribute__((warn_unused_result)), because GCC does not silence them via
|
||||||
// (void) cast.
|
// (void) cast.
|
||||||
# define _LIBCPP_NODISCARD_ATTRIBUTE
|
# define _LIBCPP_NODISCARD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
|
// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
|
||||||
// specified as such as an extension.
|
// specified as such as an extension.
|
||||||
#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
|
#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
|
||||||
# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE
|
# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD
|
||||||
#else
|
#else
|
||||||
# define _LIBCPP_NODISCARD_EXT
|
# define _LIBCPP_NODISCARD_EXT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \
|
#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \
|
||||||
(_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD))
|
(_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD))
|
||||||
# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE
|
# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD
|
||||||
#else
|
#else
|
||||||
# define _LIBCPP_NODISCARD_AFTER_CXX17
|
# define _LIBCPP_NODISCARD_AFTER_CXX17
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2340,7 +2340,7 @@ template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
|
||||||
|
|
||||||
#ifndef _LIBCPP_CXX03_LANG
|
#ifndef _LIBCPP_CXX03_LANG
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_NODISCARD_ATTRIBUTE _LIBCPP_INLINE_VISIBILITY constexpr
|
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||||
typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept {
|
typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept {
|
||||||
return static_cast<typename make_unsigned<_Tp>::type>(__x);
|
return static_cast<typename make_unsigned<_Tp>::type>(__x);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue