From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 4/5] Define HOST_UTF32 in charset.h
Date: Mon, 28 Feb 2022 11:33:03 -0700 [thread overview]
Message-ID: <20220228183304.1162089-5-tromey@adacore.com> (raw)
In-Reply-To: <20220228183304.1162089-1-tromey@adacore.com>
rust-parse.c has a #define for the host-specific UTF-32 charset name.
A later patch needs the same thing, so this patch moves the definition
to charset.h for easier reuse.
---
gdb/charset.h | 6 ++++++
gdb/rust-parse.c | 12 ++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gdb/charset.h b/gdb/charset.h
index 7a7041f10f2..2daa9a25060 100644
--- a/gdb/charset.h
+++ b/gdb/charset.h
@@ -159,4 +159,10 @@ class wchar_iterator
character. */
char host_letter_to_control_character (char c);
+#if WORDS_BIGENDIAN
+#define HOST_UTF32 "UTF-32BE"
+#else
+#define HOST_UTF32 "UTF-32LE"
+#endif
+
#endif /* CHARSET_H */
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 1f75b4290c2..4006df7086b 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -33,12 +33,6 @@
using namespace expr;
-#if WORDS_BIGENDIAN
-#define UTF32 "UTF-32BE"
-#else
-#define UTF32 "UTF-32LE"
-#endif
-
/* A regular expression for matching Rust numbers. This is split up
since it is very long and this gives us a way to comment the
sections. */
@@ -601,7 +595,8 @@ lex_multibyte_char (const char *text, int *len)
return 0;
auto_obstack result;
- convert_between_encodings (host_charset (), UTF32, (const gdb_byte *) text,
+ convert_between_encodings (host_charset (), HOST_UTF32,
+ (const gdb_byte *) text,
quote, 1, &result, translit_none);
int size = obstack_object_size (&result);
@@ -732,7 +727,8 @@ rust_parser::lex_string ()
if (is_byte)
obstack_1grow (&obstack, value);
else
- convert_between_encodings (UTF32, "UTF-8", (gdb_byte *) &value,
+ convert_between_encodings (HOST_UTF32, "UTF-8",
+ (gdb_byte *) &value,
sizeof (value), sizeof (value),
&obstack, translit_none);
}
--
2.31.1
next prev parent reply other threads:[~2022-02-28 18:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 18:32 [PATCH 0/5] Handle non-ASCII identifiers in Ada Tom Tromey
2022-02-28 18:33 ` [PATCH 1/5] Simplify a regular expression in ada-lex.l Tom Tromey
2022-02-28 18:33 ` [PATCH 2/5] Don't pre-size result string in ada_decode Tom Tromey
2022-02-28 18:33 ` [PATCH 3/5] Let phex and phex_nz handle sizeof_l==1 Tom Tromey
2022-03-01 14:26 ` Simon Marchi
2022-03-01 14:32 ` Tom Tromey
2022-02-28 18:33 ` Tom Tromey [this message]
2022-02-28 18:33 ` [PATCH 5/5] Handle non-ASCII identifiers in Ada Tom Tromey
2022-02-28 18:59 ` Eli Zaretskii
2022-02-28 20:59 ` Tom Tromey
2022-03-01 3:28 ` Eli Zaretskii
2022-03-01 14:49 ` Tom Tromey
2022-03-01 15:17 ` Eli Zaretskii
2022-03-01 15:33 ` Tom Tromey
2022-03-07 14:52 ` [PATCH 0/5] " 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=20220228183304.1162089-5-tromey@adacore.com \
--to=tromey@adacore.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).