public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <format> friend declarations
Date: Tue, 12 Sep 2023 18:04:33 +0100	[thread overview]
Message-ID: <CACb0b4mFNOX5qkzypXackztnz+r85y=MwF9Ozco8xREH8pX1Aw@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4nzK_F9nHRNj4eAHaXffWSNsx0L=TD3xktdmKv0aHebYg@mail.gmail.com>

On Tue, 12 Sept 2023 at 17:47, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Wed, 23 Aug 2023 at 18:35, François Dumont via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > Hi
> >
> > The few tests that are failing in versioned namespace mode are due to
> > those friend declarations.
> >
> > This is a fix proposal even if I considered 2 other options:
> >
> > 1. Make __format::_Arg_store a struct and so do not bother with friend
> > declarations.
> >
> > 2. Consider it as a compiler bug and do nothing. In this case I think we
> > might still need this patch to avoid a non-working format library in
> > versioned namespace mode in gcc 14 if compiler bug is not fixed.
>
> It definitely is a compiler bug, this is PR c++/59256.
>
> Please add a comment to the new macro definition, so we remember to
> remove it when it's not needed:
>
>
> #if _GLIBCXX_INLINE_VERSION
> // Needed because of PR c++/59526
> # define _GLIBCXX_STD_V std::__8
> #else
> # define _GLIBCXX_STD_V std
> #endif
>
>
> OK with that change, thanks.

Actually, are you sure the friend std::basic_format_args declaration
needs to change?

I only see errors for the friend function, not the friend class. So
this seems to fix it:

--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3437,7 +3437,13 @@ namespace __format

      template<typename _Ctx, typename... _Argz>
       friend auto
-       std::make_format_args(_Argz&&...) noexcept;
+#if _GLIBCXX_INLINE_VERSION
+       // Needed for PR c++/59526
+       std::__8::
+#else
+       std::
+#endif
+       make_format_args(_Argz&&...) noexcept;

      // For a sufficiently small number of arguments we only store values.
      // basic_format_args can get the types from the _Args pack.




>
>
> >
> > I can also define _GLIBCXX_STD_V at <format> level to limit impact.
> >
> >      libstdc++: [_GLIBCXX_INLINE_VERSION] Fix <format> friend declarations
> >
> >      GCC do not consider the inline namespace in friend declarations. We
> > need
> >      to explicit this namespace.
> >
> >      libstdc++-v3/ChangeLog:
> >
> >              * include/bits/c++config (_GLIBCXX_STD_V): New macro giving
> > current
> >              std namespace with optionally the version namespace.
> >              * include/std/format (std::__format::_Arg_store): Use
> > latter on friend
> >              declarations.
> >
> > Tested under versioned mode.
> >
> > Ok to commit ?
> >
> > François


  reply	other threads:[~2023-09-12 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 17:35 François Dumont
2023-09-07 16:59 ` François Dumont
2023-09-12 16:47 ` Jonathan Wakely
2023-09-12 17:04   ` Jonathan Wakely [this message]
2023-09-13 20:47     ` François Dumont
2023-09-13 20:50       ` Jonathan Wakely
2024-01-11 13:53         ` Jonathan Wakely

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='CACb0b4mFNOX5qkzypXackztnz+r85y=MwF9Ozco8xREH8pX1Aw@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).