public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Add [[nodiscard]] to std::byteswap
@ 2021-11-30  8:56 Jakub Jelinek
  2021-11-30 10:41 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2021-11-30  8:56 UTC (permalink / raw)
  To: gcc-patches, libstdc++

Hi!

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

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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

	* include/std/bit (byteswap): Add [[nodiscard]].

--- libstdc++-v3/include/std/bit.jj	2021-11-28 16:32:15.204524854 +0100
+++ libstdc++-v3/include/std/bit	2021-11-29 17:40:00.781074520 +0100
@@ -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
     {

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Add [[nodiscard]] to std::byteswap
  2021-11-30  8:56 [PATCH] libstdc++: Add [[nodiscard]] to std::byteswap Jakub Jelinek
@ 2021-11-30 10:41 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-11-30 10:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc Patches, libstdc++

On Tue, 30 Nov 2021 at 08:58, Jakub Jelinek via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Hi!
>
> This patch adds [[nodiscard]] to std::byteswap, because the function
> template doesn't do anything useful if the result isn't used.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Yes, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-30 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  8:56 [PATCH] libstdc++: Add [[nodiscard]] to std::byteswap Jakub Jelinek
2021-11-30 10:41 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).