This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA-v3] Handle cygwin wchar_t specifics
- From: Tom Tromey <tromey at redhat dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: "'Eli Zaretskii'" <eliz at gnu dot org>, <jan dot kratochvil at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Mon, 18 Apr 2011 11:17:44 -0600
- Subject: Re: [RFA-v3] Handle cygwin wchar_t specifics
- References: <5928.31498147479$1302882967@news.gmane.org> <m3ei53cres.fsf@fleche.redhat.com> <005101cbfc50$193136b0$4b93a410$%muller@ics-cnrs.unistra.fr> <20110416162455.GA5599@host1.jankratochvil.net> <000001cbfc7d$3f67f440$be37dcc0$%muller@ics-cnrs.unistra.fr> <83zknpoacd.fsf@gnu.org> <21014.6501930014$1303139687@news.gmane.org>
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> This patch also changes the intermediate_encoding for mingw hosts,
Pierre> from "wchar_t" to "UTF-16LE", but this seems to work nicely
Pierre> for both mingw32 and mingw64 (and only if iconv is found,
Pierre> otherwise gdb_wchar_t is simply char and phony functions are used).
Pierre> -#define INTERMEDIATE_ENCODING host_charset ()
Pierre> +#define DEFAULT_INTERMEDIATE_ENCODING host_charset ()
This changes the behavior if the gdb user changes the host encoding.
This is an unusual situation, admittedly, but it seems to me that it is
just as easy to only introduce the `intermediate_encoding' global in the
UTF-{16,32} case.
Pierre> + intermediate_encoding = DEFAULT_INTERMEDIATE_ENCODING;
Pierre> +# if defined (USE_WIN32API) || defined (__CYGWIN__)
Pierre> + if (sizeof (gdb_wchar_t) == 2)
Pierre> + intermediate_encoding = "UTF-16LE";
Pierre> +# endif
Here, instead of a special case for __CYGWIN__, and instead of
hard-coding the endian-ness, just use the same code for all
__STDC_ISO_10646__ platforms. Maybe something like:
intermediate_encoding = xstrprintf ("UTF-%d%s", 8 * sizeof (wchar_t),
WORDS_BIGENDIAN ? "BE" : "LE");
Tom