diff options
author | Tom Tromey <tromey@adacore.com> | 2022-02-03 12:04:36 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-03-07 07:52:59 -0700 |
commit | ee3d46491537e343c276a7fc455dd94812fd3f72 (patch) | |
tree | e3be26c2f6bc0b3721bc202c656a6028cd80d14e /gdb | |
parent | c8b76e1ec346de509dbcc2c6dfc4519c572f7322 (diff) | |
download | gdb-ee3d46491537e343c276a7fc455dd94812fd3f72.zip gdb-ee3d46491537e343c276a7fc455dd94812fd3f72.tar.gz gdb-ee3d46491537e343c276a7fc455dd94812fd3f72.tar.bz2 |
Define HOST_UTF32 in charset.h
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/charset.h | 6 | ||||
-rw-r--r-- | gdb/rust-parse.c | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/gdb/charset.h b/gdb/charset.h index 7a7041f..2daa9a25 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 1f75b42..4006df7 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); } |