This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA-v3] Handle cygwin wchar_t specifics


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]