public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <mcgrathr@google.com>
To: Binutils <binutils@sourceware.org>, GDB <gdb-patches@sourceware.org>
Subject: [PATCH users/roland/safe-ctype] Uniformly put `#include "safe-ctype.h"` last among #include directives
Date: Sun, 23 Apr 2023 17:55:02 -0700	[thread overview]
Message-ID: <CAB=4xhqymf9YERgD3tP4Hyg7=nc8NdepcGvDgO8qAEDcB=YtNg@mail.gmail.com> (raw)

The libc++ headers changed recently such that some standard C++
headers that didn't used
to lead to using <ctype.h> and its symbols now do so.

This ran afoul of the shenanigans in "safe-ctype.h" in at least one
place where that header
is included before a standard header.

This only broke things that I saw in gdb/minsyms.c, but the same
problem may well arise
in the future with other headers.  This sort of redefinition of
standard symbols is definitely not
kosher under the C and C++ standards at all.  In the long run we
should consider ways to solve
the problem "safe-ctype.h" exists to solve without violating the
language standards in this way.

To make the code more future-proof while we're still doing this, I
changed all the uses
uniformly throughout the repo to just put #include "safe-ctype.h"
last, with a comment
reminding folks not to change that ordering (and a comment in
safe-ctype.h about that).

I didn't touch anything in the libiberty subdirectory since AIUI
that's still copied from
the gcc repository.

The changes are on the users/roland/safe-ctype branch on sourceware.  My mailer
makes it difficult to paste a large patch like this into the message
without mangling
it. It's very mechanical and I figure everyone actively concerned can
look at the git
branch on sourceware easily enough for themselves.

OK for trunk?


Thanks,
Roland

             reply	other threads:[~2023-04-24  0:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24  0:55 Roland McGrath [this message]
2023-04-24  3:03 ` Alan Modra
2023-04-24 17:21 ` Tom Tromey
2023-04-24 17:40   ` Roland McGrath
2023-04-29  7:36     ` Roland McGrath

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='CAB=4xhqymf9YERgD3tP4Hyg7=nc8NdepcGvDgO8qAEDcB=YtNg@mail.gmail.com' \
    --to=mcgrathr@google.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.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).