From: Tom Tromey <tom@tromey.com>
To: Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: add UTF16/UTF32 target charsets in phony_iconv
Date: Fri, 07 Oct 2022 14:10:50 -0600 [thread overview]
Message-ID: <87k05bs8c5.fsf@tromey.com> (raw)
In-Reply-To: <20221002140010.106238-1-patrick@monnerat.net> (Patrick Monnerat via Gdb-patches's message of "Sun, 2 Oct 2022 16:00:10 +0200")
>>>>> "Patrick" == Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org> writes:
Patrick> Function phony_iconv is substituted to the system-supplied iconv on
Patrick> platforms where the latter is deficient.
I sort of hate to improve the phony iconv, but I get why one might want
to.
Patrick> Conditonal statements decide when the substitution occurs. This
Patrick> currently enables it for mingw (wchar_t is not UTF-32) even when the
Patrick> system-supplied iconv is suitable for gdb use.
I don't recall the outcome from this, but is there no way to improve gdb
to use this iconv? If it truly works well enough then it seems like it
would be the better approach.
Patrick> + static struct
This can also be const.
Patrick> +#if WORDS_BIGENDIAN
Patrick> + { "wchar_t", (sizeof (gdb_wchar_t) - 1) | TOKEN_BIGENDIAN },
Patrick> +#else
Patrick> + { "wchar_t", (sizeof (gdb_wchar_t) - 1) },
Patrick> +#endif
This has tabs before the strings but there's no need.
Patrick> + { NULL, -1 }
...
Patrick> + for (auto p = encodings; p->name; p++)
Patrick> + if (strcmp (encoding, p->name) == 0)
Patrick> + return p->token;
You can drop the trailing null entry and just do:
for (auto p : encodings)
Patrick> + if(token & ~((TOKEN_MASK << TOKEN_BITS) | TOKEN_MASK))
Missing space after the "if".
Patrick> + maxval = 1UL << (7 * tosize); /* Split shift to avoid count overflow. */
gdb doesn't generally use comments at the end of the line.
Tom
next prev parent reply other threads:[~2022-10-07 20:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-02 14:00 Patrick Monnerat
2022-10-07 20:10 ` Tom Tromey [this message]
2022-10-08 0:12 ` Patrick Monnerat
2022-10-08 18:55 ` Tom Tromey
2022-10-09 0:47 ` Patrick Monnerat
2022-10-10 16:11 ` Tom Tromey
2022-10-16 1:50 ` Tom Tromey
2022-10-16 6:24 ` Eli Zaretskii
2022-10-17 23:10 ` 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=87k05bs8c5.fsf@tromey.com \
--to=tom@tromey.com \
--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).