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 uses of non-reserved names in headers
Date: Thu, 16 Feb 2023 12:00:06 +0000	[thread overview]
Message-ID: <CACb0b4kAFUdJiK0jjB4yRmn_G_8SUkGjvRKUkMMm+apPrj+Kaw@mail.gmail.com> (raw)
In-Reply-To: <Y+4J2qJQcf/dgEsK@tucnak>

On Thu, 16 Feb 2023 at 10:48, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Thu, Feb 16, 2023 at 10:30:30AM +0000, Jonathan Wakely via Gcc-patches wrote:
> > Tested powerpc64le-linux. Pushed to trunk.
> >
> > These should be backported too.
> >
> > -- >8 --
> >
> > The non-reserved names 'val' and 'dest' were being used in our headers
> > but haven't been added to the 17_intro/names.cc test. That's because
> > they are used by <asm-generic/posix_types.h> and <netinet/tcp.h>
> > respecitvely on glibc-based systems.
>
> So, can't we for such problematic names add hacks, like some directory
> which the test adds as -isystem before the standard ones and contains
> some header wrappers which temporarily
> #undef val
> #undef dest
> (or whatever other name), then
> #include_next ...
> and then define them again?
> Doesn't need to be for all targets of course, but just something to cover
> at least the most common ones.
>
> Or perhaps even do it differently, add 2 headers, one which defines
> all those #define whatever (, one that #undef whatever them all,
> and add wrappers in a -isystem directory for all non-gcc owned headers
> used by the libstdc++ headers, which would include this #undef header
> first and #define at the end.  That way we wouldn't test non-reserved
> names in say libc headers, just in libstdc++ headers.

We could, but it seems like a lot of work just for "val" and "dest",
when there are much simpler solutions :-)


  parent reply	other threads:[~2023-02-16 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 10:30 Jonathan Wakely
2023-02-16 10:47 ` Jakub Jelinek
2023-02-16 11:45   ` Jakub Jelinek
2023-02-16 12:02     ` Jonathan Wakely
2023-02-16 12:00   ` Jonathan Wakely [this message]
2023-02-16 13:23 Maciej Cencora

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=CACb0b4kAFUdJiK0jjB4yRmn_G_8SUkGjvRKUkMMm+apPrj+Kaw@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).