From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdbsupport] Poison ctype.h / cctype functions
Date: Tue, 24 Mar 2026 10:05:52 +0100 [thread overview]
Message-ID: <a90297bd-b182-41c3-b886-43e88c885a53@suse.de> (raw)
In-Reply-To: <87jyv28wbg.fsf@tromey.com>
On 3/23/26 3:17 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> GDB generally uses c_isprint instead of isprint or std::isprint [1].
> Tom> Poison uses of ctype.h / cctype functions in gdbsupport/poison.h.
>
> Tom> This excludes isupper, islower and toupper because they're currently used in
> Tom> GDB. Add a fixme to find out whether these exceptions are ok, and if so
> Tom> document why, otherwise fix them.
>
> Tom> +#define POISON_CCTYPE(F) \
> Tom> + template<typename T> \
> Tom> + F \
> Tom> + { \
> Tom> + static_assert (false, "Please use gnulib's c-ctype.h"); \
> Tom> + return 0; \
> Tom> + }
> Tom> +
> Tom> +/* Poisoning of some functions is disabled:
> Tom> + - isupper, because it's used in ada_decode.
>
> This is just an oversight.
>
I've submitted a patch for this (
https://sourceware.org/pipermail/gdb-patches/2026-March/226148.html ).
Thanks,
- Tom
> Tom> + - islower and toupper, because they're used in UNCTRL from readline,
> Tom> + which is used in tui_redisplay_readline and gdb_fnprint.
>
> Can't really touch readline but we could write our own UNCTRL variant.
>
> Tom> +POISON_CCTYPE (int isalnum (T c));
> Tom> +POISON_CCTYPE (int std::isalnum (T c));
>
> I suspect redefining standard functions like this is not allowed in C++.
>
> Tom
next prev parent reply other threads:[~2026-03-24 9:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 16:03 Tom de Vries
2026-03-23 14:17 ` Tom Tromey
2026-03-24 9:05 ` Tom de Vries [this message]
2026-03-24 13:28 ` Tom de Vries
2026-03-24 13:55 ` Tom de Vries
2026-03-24 14:42 ` Tom Tromey
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=a90297bd-b182-41c3-b886-43e88c885a53@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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