public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jonathan Wakely <jwakely@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 11:47:54 +0100	[thread overview]
Message-ID: <Y+4J2qJQcf/dgEsK@tucnak> (raw)
In-Reply-To: <20230216103030.94868-1-jwakely@redhat.com>

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.

What both of these break though is if libstdc++ headers try to use
__has_include etc. on them, because the added wrapper will mean they will
show as existing.

	Jakub


  reply	other threads:[~2023-02-16 10:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 10:30 Jonathan Wakely
2023-02-16 10:47 ` Jakub Jelinek [this message]
2023-02-16 11:45   ` Jakub Jelinek
2023-02-16 12:02     ` Jonathan Wakely
2023-02-16 12:00   ` 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=Y+4J2qJQcf/dgEsK@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).