Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/3] Use gnulib c-ctype module, not <ctype.h>
Date: Wed, 6 Aug 2025 15:46:45 -0400	[thread overview]
Message-ID: <af62472a-5584-40da-b205-d3fbb409ab90@simark.ca> (raw)
In-Reply-To: <20250806-gnulib-c-ctype-v1-0-10f33e9f22a4@adacore.com>

On 8/6/25 9:13 AM, Tom Tromey wrote:
> This series changes gdb to use the gnulib c-ctype module rather than
> <ctype.h> or "safe-ctype.h".
> 
> The rationale is mostly in patch #3.  I do wonder if it would be
> better to just add the casts everywhere.
> 
> Regression tested on x86-64 Fedora 41.  This doesn't cover
> solib-rocm.c though.
> 
> Signed-off-by: Tom Tromey <tromey@adacore.com>

My understanding is that poisoning using macros doesn't work, because it
interferes with identifiers of the same name in other headers.  But
would it be possible to do it using "#pragma GCC poison"?  Like:

  #pragma GCC poison isspace

If I try to use it, I get:

      CXX    cp-support.o
    /home/smarchi/src/binutils-gdb/gdb/cp-support.c:1137:22: error: attempt to use poisoned ‘isspace’
     1137 |               while (isspace(name[index]))
          |                      ^
    In file included from /home/smarchi/src/binutils-gdb/gdb/defs.h:26,
                     from <command-line>:
    /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/common-defs.h:231:20: note: poisoned here
      231 | #pragma GCC poison isspace
          |                    ^~~~~~~

This pragma can obviously be gated by an appropriate ifdef, if not all
compilers support it.

I was wondering if clang-tidy would have a check for this.  The answer
is no, but there is a bug open about it:

  https://github.com/llvm/llvm-project/issues/63280

Simon

  parent reply	other threads:[~2025-08-06 19:47 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 ` Simon Marchi [this message]
2025-08-07 20:39   ` [PATCH 0/3] Use gnulib c-ctype module, not <ctype.h> Tom Tromey
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=af62472a-5584-40da-b205-d3fbb409ab90@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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