libstdc++: Add [[nodiscard]] to std::byteswap

This patch adds [[nodiscard]] to std::byteswap, because the function
template doesn't do anything useful if the result isn't used.

2021-11-30  Jakub Jelinek  <jakub@redhat.com>

	* include/std/bit (byteswap): Add [[nodiscard]].
This commit is contained in:
Jakub Jelinek 2021-11-30 13:30:27 +01:00
parent 365cd5f9ba
commit 92084a6dcd

View File

@ -83,6 +83,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Reverse order of bytes in the object representation of `value`.
template<typename _Tp>
[[nodiscard]]
constexpr enable_if_t<is_integral<_Tp>::value, _Tp>
byteswap(_Tp __value) noexcept
{