]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add [[nodiscard]] to std::byteswap
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 Nov 2021 12:30:27 +0000 (13:30 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 30 Nov 2021 12:30:27 +0000 (13:30 +0100)
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]].

libstdc++-v3/include/std/bit

index 18ce5ca220c1194d9b6980a09c3a2d34928817fa..4facb6150142e9990b52935e7a17d88e32d07e1e 100644 (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
     {