From: Tom Tromey <tromey@adacore.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/3] Use gnulib c-ctype module, not <ctype.h>
Date: Thu, 07 Aug 2025 14:39:24 -0600 [thread overview]
Message-ID: <87h5yiq32b.fsf@tromey.com> (raw)
In-Reply-To: <af62472a-5584-40da-b205-d3fbb409ab90@simark.ca> (Simon Marchi's message of "Wed, 6 Aug 2025 15:46:45 -0400")
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> My understanding is that poisoning using macros doesn't work, because it
Simon> interferes with identifiers of the same name in other headers. But
Simon> would it be possible to do it using "#pragma GCC poison"? Like:
I didn't try it but that's because I believe it won't work.
The pragma is better than the preprocessor approach, the manual says:
If a poisoned identifier appears as part of the expansion of a
macro which was defined before the identifier was poisoned, it will
_not_ cause an error. This lets you poison an identifier without
worrying about system headers defining macros that use it.
However in our case the poisoning would likely occur before the
inclusion of the offending header. The workaround would be to include
the locale (and maybe iostream?) headers everywhere, but I think we
definitely should not do that.
FTR the failure I saw (with cpp-style poisoning, a la safe-ctype.h) came
from source-cache.c which includes some locale stuff via <sstream>.
The main issue here is that the pragma works on an identifier basis but
really we'd like to be more selective and only exclude some particular
functions.
Tom
next prev parent reply other threads:[~2025-08-07 20:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 13:13 Tom Tromey
2025-08-06 13:13 ` [PATCH 1/3] Import the c-ctype module from gnulib Tom Tromey
2025-08-06 13:13 ` [PATCH 2/3] Use c-ctype.h (not safe-ctype.h) in gdb Tom Tromey
2025-08-06 13:13 ` [PATCH 3/3] Use gnulib c-ctype module " Tom Tromey
2025-08-06 19:46 ` [PATCH 0/3] Use gnulib c-ctype module, not <ctype.h> Simon Marchi
2025-08-07 20:39 ` Tom Tromey [this message]
2025-08-20 17:14 ` Simon Marchi
2025-09-09 17:53 ` Tom Tromey
2025-09-09 18:01 ` Simon Marchi
2025-09-09 18:55 ` Tom Tromey
2025-10-14 13:00 ` Guinevere Larsen
2025-10-14 19:19 ` Tom Tromey
2025-10-16 15:30 ` Tom Tromey
2025-10-16 21:50 ` Luis
2025-10-21 12:59 ` Tom Tromey
2025-10-21 17:37 ` Simon Marchi
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=87h5yiq32b.fsf@tromey.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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