aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-11-30 13:30:27 +0100
committerJakub Jelinek <jakub@redhat.com>2021-11-30 13:30:27 +0100
commit92084a6dcda8aaee538b4512bbaf161e1155a296 (patch)
tree04e59f22c541a433b45fdb271f0956887843dfdf
parent365cd5f9ba812c389b404a53d99ab5dded5097f4 (diff)
downloadgcc-92084a6dcda8aaee538b4512bbaf161e1155a296.zip
gcc-92084a6dcda8aaee538b4512bbaf161e1155a296.tar.gz
gcc-92084a6dcda8aaee538b4512bbaf161e1155a296.tar.bz2
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]].
-rw-r--r--libstdc++-v3/include/std/bit1
1 files changed, 1 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 18ce5ca..4facb61 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -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
{