public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: "Jonathan Wakely via Libstdc++" <libstdc++@gcc.gnu.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	hp@gcc.gnu.org
Subject: Re: [committed 2/2] libstdc++: Use GCC's predefined macro for endianness [PR104080]
Date: Tue, 18 Jan 2022 20:51:05 +0000	[thread overview]
Message-ID: <CACb0b4kU+ZJJnFFd7LxAN6+A_5iTghkrfjuwFjs+MDvJJBv_sw@mail.gmail.com> (raw)
In-Reply-To: <72d10922-c557-855c-4d86-3b8fca47b100@idea>

On Tue, 18 Jan 2022 at 20:01, Patrick Palka <ppalka@redhat.com> wrote:

> On Tue, 18 Jan 2022, Patrick Palka wrote:
>
> > On Tue, Jan 18, 2022 at 5:12 AM Jonathan Wakely <jwakely@redhat.com>
> wrote:
> > >
> > > Tested x86_64-linux, pushed to trunk.
> > >
> > >
> > > Instead of hardcoded preprocessor conditionals with explicit target
> > > checks, just rely on the fact that __BYTE_ORDER__ is always defined by
> > > GCC.
> >
> > Thanks a lot for fixing these!  I apparently missed removing this
> > batch of #includes from the amalgamation in r12-6647.  For
> > completeness I suppose we should remove these #includes too.   I
> > wonder if we can rely on __BYTE_ORDER__ being defined by other
> > compilers?
>
>
We already use it unconditionally in <bit>, for std::endian.

I actually considered replacing all the FAST_FLOAT_USES_BIG_ENDIAN
preprocessor checks with:

if constexpr (std::endian::native == std::endian::big)

But it would make the diffs from upstream bigger for no benefit.

I did wonder whether some of those functions could avoid doing memcpy then
byteswap, if we just swapped the bytes without the memcpy. But GCC probably
optimizes that code well anyway, so I didn't even bother checking it.
Upstream probably tested that already as well.



> (N.B. not just for completeness but potentially also for correctness,
> since floating_from_chars.cc #includes "fast_float/fast_float.h" into an
> anonymous namespace, and we probably shouldn't be #including system
> headers into an anonymous namespace..)
>

Good point.

  reply	other threads:[~2022-01-18 20:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 10:12 [committed 1/2] libstdc++: Fix deduction failure for std::min call [PR104080] Jonathan Wakely
2022-01-18 10:12 ` [committed 2/2] libstdc++: Use GCC's predefined macro for endianness [PR104080] Jonathan Wakely
2022-01-18 19:44   ` Patrick Palka
2022-01-18 20:01     ` Patrick Palka
2022-01-18 20:51       ` Jonathan Wakely [this message]
2022-01-18 20:10     ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACb0b4kU+ZJJnFFd7LxAN6+A_5iTghkrfjuwFjs+MDvJJBv_sw@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).