This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC-v4] 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: <gdb-patches at sourceware dot org>
- Date: Tue, 19 Apr 2011 07:19:26 -0600
- Subject: Re: [RFC-v4] 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> <m3zknn7a2v.fsf@fleche.redhat.com> <34716.7311156683$1303204711@news.gmane.org>
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> 1) we should really use "gdb_wchar_t" type, not "wchar_t"
Yeah.
Pierre> 2) If sizeof(gdb_wchar_t) == 1
Pierre> I don't think that UTF-8LE and UTF-8BE exist, do they?
Pierre> At least they are not in the iconv -l list for current cygwin.
A platform where this is true should not define __STDC_ISO_10646__.
You might as well just assert that the size is 2 or 4.
Pierre> 3) WORD_BIGENDIAN is not defined at all on Cygwin,
Pierre> so that your code would probably not compile.
Yeah, I forgot, you need #if. See config.in.
Pierre> A further question is whether UTF-32 is always supported...
If someone can find a platform where wchar_t is 4 bytes, where
__STDC_ISO_10646__ is defined, and where UTF-32 is not understood, then
we can complain bitterly and change the code again.
Pierre> Below is yet another proposal:
Pierre> it transforms INTERMEDIATE_ENCODING macro into a call to
Pierre> intermediate_encoding function.
I'd prefer it if the new code is only used in the __STDC_ISO_10646__
case.
Pierre> +#ifdef WORDS_BIGENDIAN
#if
Pierre> +const char *
Pierre> +intermediate_encoding (void)
New functions require an introductory comment.
Pierre> #ifdef PHONY_ICONV
Pierre> -#define INTERMEDIATE_ENCODING "wchar_t"
Pierre> +#define DEFAULT_INTERMEDIATE_ENCODING "wchar_t"
I don't think DEFAULT_INTERMEDIATE_ENCODING is needed.
Tom