public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [committed] libstdc++: Fix detection of std::format support for __float128 [PR107693]
Date: Tue, 15 Nov 2022 15:45:13 +0000	[thread overview]
Message-ID: <CACb0b4k754e6_FZkAQ8rFYvAZkVfXbVJPVRJkgF+jq+hTpb8zQ@mail.gmail.com> (raw)
In-Reply-To: <Y3OlYquRY4UnDnps@tucnak>

On Tue, 15 Nov 2022 at 14:42, Jakub Jelinek wrote:
>
> On Tue, Nov 15, 2022 at 02:31:19PM +0000, Jonathan Wakely via Gcc-patches wrote:
> > Tested x86_64-linux and x86_64-w64-mingw32. Pushed to trunk.
> >
> > -- >8 --
> >
> > std::format gives linker errors on targets that define __float128 but
> > do not support using it with std::to_chars. This improves the handling
> > of 128-bit flaoting-point types so they are disabled if unsupportable.
> >
> > libstdc++-v3/ChangeLog:
> >
> >       PR libstdc++/107693
> >       * include/std/format (_GLIBCXX_FORMAT_F128): Define to 2 when
> >       basic_format_arg needs to use its _M_f128 member.
> >       (__extended_floating_point, __floating_point): Replace with ...
> >       (__formattable_floating_point): New concept.
> >       * testsuite/std/format/functions/format.cc: Check whether
> >       __float128 is supported. Also test _Float128.
>
> > --- a/libstdc++-v3/include/std/format
> > +++ b/libstdc++-v3/include/std/format
>
> > +#elif __FLT128_DIG__ && defined(__GLIBC_PREREQ) // see floating_to_chars.cc
>
> I'd just use here
> #elif __FLT128_DIG__ && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
> instead.
>
> The reason for defined(__GLIBC_PREREQ) in floating_{to,from}_chars.cc
> is that I didn't want to make the ABI of linux libstdc++.so.6 dependent
> on whether gcc was built against glibc 2.26+ or older glibc.
> So, the symbols exist in libstdc++.so.6 even for older glibcs, but it will
> actually only work properly (without losing precision; otherwise it will
> just go through long double) if at runtime one uses glibc 2.26+.

Yes, and my intention was that std::format would also support
__float128, with the same imprecise behaviour. But could just limit
std::format support to when std::to_chars works properly.

> But in the headers, defined(_GLIBCXX_HAVE_FLOAT128_MATH) is used everywhere
> else (which is true only when compiling against glibc 2.26+).


      reply	other threads:[~2022-11-15 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 14:31 Jonathan Wakely
2022-11-15 14:42 ` Jakub Jelinek
2022-11-15 15:45   ` Jonathan Wakely [this message]

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=CACb0b4k754e6_FZkAQ8rFYvAZkVfXbVJPVRJkgF+jq+hTpb8zQ@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /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).