On Fri, Mar 30, 2007 at 01:59:12PM +0100, Thomas Gill wrote:
> 
> Hi there,
> 
> I maintain a GCC port for a small 16 bit processor called XAP2+. I'm
> having problems with strings of wide characters.
> 
> I have the following defines, among others:
> 
> #define BITS_PER_UNIT           16
> ...
> #define WCHAR_TYPE              "int"
> #define WCHAR_TYPE_SIZE         16
> 
> So, I'm expecting char and wchar_t to both be 16 bits wide.

I think the problem is that we've not told libcpp what the correct
narrow character set is.  I suggest adding something like

  if (BITS_PER_UNIT >= 32)
    cpp_opts->narrow_charset = BYTES_BIG_ENDIAN ? "UTF-32BE" : "UTF-32LE";
  else if (BITS_PER_UNIT >= 16)
    cpp_opts->narrow_charset = BYTES_BIG_ENDIAN ? "UTF-16BE" : "UTF-16LE";

in a likely looking place in c_common_init_options.  Then you
shouldn't have to do any translation in your output routines
at all.


r~

Reply via email to