public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Jason Merrill <jason@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	libstdc++ <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] c++: Implement __is_{nothrow_,}convertible [PR106784]
Date: Fri, 23 Sep 2022 11:04:37 -0400	[thread overview]
Message-ID: <Yy3LBdAaSkmX2w8v@redhat.com> (raw)
In-Reply-To: <CACb0b4niNgAfWpdzTaT1RTCUbFWdjF-VqO+wTyhGBSiD9w9Gwg@mail.gmail.com>

On Fri, Sep 23, 2022 at 03:40:23PM +0100, Jonathan Wakely wrote:
> On Thu, 22 Sept 2022 at 23:14, Jason Merrill wrote:
> > On 9/22/22 09:39, Marek Polacek wrote:
> > > This patch doesn't make libstdc++ use the new built-ins, but I had to
> > > rename a class otherwise its name would clash with the new built-in.
> >
> > Sigh, that's going to be a hassle when comparing compiler versions on
> > preprocessed code.
> 
> Good point. Clang has some gross hacks that we could consider. When it
> sees a declaration that uses a built-in name, it disables the built-in
> for the remainder of the translation unit. It does this precisely to
> allow a new Clang to compile old std::lib headers where a built-in
> like __is_assignable was used as a normal class template, not the
> built-in (because no such built-in existed at the time the library
> code was written). For us, this is only really a problem when
> bisecting bugs and using a newer compiler to compile .ii files from
> odler headers, but for Clang combining a new Clang with older
> libstdc++ headers is a hard requirement (recall that when Clang was
> first deployed to macOS it had to consume the system's libstdc++ 4.2
> headers).
> 
> It's a big kluge, but it would mean that a new GCC could happily
> consume preprocessed code from older libstdc++ headers.

Ah, you're right, it must be this lib/Parse/ParseDeclCXX.cpp code:

    // GNU libstdc++ 4.2 and libc++ use certain intrinsic names as the
    // name of struct templates, but some are keywords in GCC >= 4.3
    // and Clang. Therefore, when we see the token sequence "struct
    // X", make X into a normal identifier rather than a keyword, to
    // allow libstdc++ 4.2 and libc++ to work properly.
    TryKeywordIdentFallback(true);
 
Whether we want to do this, I'm not sure.

Marek


      reply	other threads:[~2022-09-23 15:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 13:39 Marek Polacek
2022-09-22 22:14 ` Jason Merrill
2022-09-23 14:34   ` Marek Polacek
2022-09-23 14:43     ` Jonathan Wakely
2022-09-23 16:34       ` Jonathan Wakely
2022-09-23 16:37         ` Marek Polacek
2022-09-23 15:54     ` Jason Merrill
2022-09-23 16:16       ` Marek Polacek
2022-09-23 14:40   ` Jonathan Wakely
2022-09-23 15:04     ` Marek Polacek [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=Yy3LBdAaSkmX2w8v@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@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).